Talk:Macro (computer science)

From Wikipedia, the free encyclopedia

This article discusses three different kinds of macros (keyboard macros, application macros, and programming macros) without clearly drawing the proper distinctions among them first. For instance the section "programming macros" is not about the kind of macros found in programming, but rather on writing application macros. Yet it occurs in a page that is mostly about the kind of macro used in programming. - furrykef (Talk at me) 20:21, 4 October 2005 (UTC)

I corrected the obvious problem with the Application/Programming macros and wrote a proper intro to the section on application macros. I think, however, that I'm just turd-polishing and the scope/structure of the article needs to be properly defined. Cheers -- Ithika 09:01, 24 April 2006 (UTC)

I've had a go at clarifying this by adapting the way that FOLDOC describes macros. I've also added a mention of TeX as a system that depends heavily on macro expansion. However, I still think the article could be improved by not starting with the rather vague bit about abstraction and patterns. This is too far removed from what a Wikipedia reader is likely to be able to grasp. An article should start with plain talk, and get into technical detail later.Sangwine 19:29, 9 December 2006 (UTC)

Contents

[edit] Huh?

I still dont get it. What's a macro?

Not an easily answered question, apparently. My understanding is:
  • Keyboard and Application macros are a rigid series of commands (like in a text editor, move up one line, delete the next word, etc). They are done blindly.
  • Programming macros are simple text search-and-replaces. You might use one to unabbreviate your abbreviations, for instance.
    • Programming macros can in my experience also mean a mini-program inside a program, which looks at source code and changes it, in ways more powerful than a simple search-and-replace, or even a search-and-replace with regexps.
--maru (talk) Contribs 23:57, 3 January 2006 (UTC)

Marudubshinki has it right, though it might also be worth expanding upon the difference between macros in, say, C and macros in lisp. Macros in C simply search through code and make textual replacements. In comparison, macros in lisp act like functions which work on expressions passed to them as if they were data. In this way, entirely new constructs can be created with macros.

Examples include CLOS and the setf system which allows for any read function to work, essentially, as an accessor function:

>> (setq x '(a b c d))
(A B C D)
>> (nth 3 x)
D
>> (setf (nth 3 x) 'a)
A
>> x
(A B C A)

In this example, the (setf (nth 3 x) 'm) line involves setf examining (nth 3 x) and replacing it with the function that sets that position, which is not standardized. In CMUCL, that line expands to (LISP::%SETNTH 3 X 'A) whereas in SBCL it expands to (SB-KERNEL:%SETNTH 3 X 'A)

--Eyvin 20:59, 6 April 2006 (UTC)

[edit] Reworked intro

So, I just reworked the intro. Comments would be nice. I'm also planning on reworking the Programming Macros section. It doesn't talk about lexical, token, and syntactic macros. Worse, hygienic macros are discussed later down the page, but never defined in the page.

[edit] Macros in MMORPGs

Macros in MMORPGs needs to be redone or deleted completely and changed to macros in online games, or a more general title. ^Aftermath^ 16:28, 3 September 2006 (UTC)

[edit] Procedural macros

I believe the D programming language would also fit under this header, as it has a preprocessor that uses the same syntax as the language itself, as well as compile-time executed functions and mixins. (AST Macros are on the drawing board, but not quite there yet) --83.109.108.7 06:00, 18 September 2007 (UTC)

[edit] Viroses

So, what probably leads most people to search for this, including myself, is the macro settings in MS Word. Could someone include how viruses might be executed using macros, and a rule of thumb for when to trust and when not to trust? Also, maybe what happens if you do/don't enable them? —Preceding unsigned comment added by Savonnn (talk • contribs) 18:51, 10 February 2008 (UTC)