Jump to content

Talk:Macro (computer science)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by ^Aftermath^ (talk | contribs) at 16:28, 3 September 2006 (Added 1 comment(s).). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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)[reply]

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)[reply]

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)[reply]

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)[reply]

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.

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)[reply]