[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Snippets

On 2020-03-28 23:39, Tim Hill wrote:

It is a macro in the sense that one click is expanded to a string but I
know what you mean.

Computing has for a long time had two related meanings for "macro".  One
is just a definition of some key-code or sequence of characters in a
source, which when encountered will be replaced by some other sequence.

The other achieves the same thing, but allows the macro definition to be
executed, rather than just define a fixed/static relationship between
one string and another.   If a macro is executable, it's just a program
that is triggered (perhaps by a keystroke) and does something. Often the
things it could do are eg "generate text that could have been in the
original source"... so in that way it appears to do the same thing as a
simple macro would have done.

Early macro facilities appeared in Assemblers, ie programs which make
it easier to write machine code.  Someone might eg note that very often
they'd use the same sequence of machine instructions, and rather than
have the tedium of having to hand code all of them each time, they'd
use a macro which replaced the macro name by the instruction sequence.

The text editor I use (a PC version of a mainframe one) has macros too,
but these are complete programs which execute within the editor.  So to
manipulate text I'm editing I don't have to export the text to another
file, run a program to do something to that file, then bring the results
back.  Instead the macro talks directly to the editor and manipulates
lines of data and characters directly.  It also lets me issue editor
commands so eg a program can build a "change command" then execute it
(and see immediately things like "how many lines were changed").

My longest macro is about 12,000 lines of code.

Jeremy Nicoll - my opinions are my own