Talk:Macro (computer science)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computer science (Rated C-class, Mid-importance)
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.

Macro languages comparison[edit]

We need a webpage that will compare macro languages! thanks! — Preceding unsigned comment added by (talk) 01:52, 9 September 2012 (UTC)


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)


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)
>> (setf (nth 3 x) '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)

I learned more by reading this "Huh" section then the intro of the article. It's too technical to the point where I can't understand it. Can it be made more accessible to the general public? Adding the above 3 points of what a macro is would be a great start! Strawberry Island (talk) 19:43, 17 July 2008 (UTC)
I agree with Strawberry Island. The current version says that a macro is something that transforms a sequence of input characters to a sequence of output characters. This is a perfect description of a procedure, especially one implemented by a Turing machine. Danielx (talk) 17:31, 28 April 2009 (UTC)

Reworked intro[edit]

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. User:Andrew Eisenberg

Andrew, it was really difficult to figure out what changes you made, since you did not sign your comment. I eventually figured it out through binary search, and correlating your comment to your changes. In case anyone is curious, the diff can be found here: [1]. Since your revision, someone has made further changes to the intro, but you may be able to help with the discussion in the previous section. Danielx (talk) 17:49, 28 April 2009 (UTC)

Macros in MMORPGs[edit]

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)

Procedural macros[edit]

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) -- 06:00, 18 September 2007 (UTC)


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 (talkcontribs) 18:51, 10 February 2008 (UTC)

Macros in Word and such are better referred to as scripting languages, which are linked from here, and probably have more discussion of security issues. Dcoetzee 22:28, 31 July 2008 (UTC)

Orphaned reference[edit]

The reference "DM dhambhere , system programming and operating system - Tata Macgrahill." looks weird here, orphaned from somewhere in the text, or just plain wrong? (User:Togr) (talk) 07:50, 20 April 2009 (UTC)

Wikipedia keyboard macros[edit]

Wikipedia editors may wish to try the hotkeys script to enable keyboard macros. —GregU (talk) 02:48, 11 August 2009 (UTC)

Etymology of Macro[edit]

I propose to correct the meaning of the word μάκρο in Greek. His main meaning is big (as the opposite of Micro), as Macrophotography, Macrocephalus, Macroeconomics, etc... —Preceding unsigned comment added by (talk) 17:12, 21 August 2009 (UTC)