Guido Gonzato wrote:
| On Wed, 2 Jul 2003, I. Oppenheim wrote:
|
| > > m: ~n3 = n{o}n{m}n
|
| I think that m: is a wonderful and very useful extension to the standard,
| but AFAIK BarFly is the only program that supports it. In my view, macros
| shouldn't be part of the notation, and should be implemented using
| external tools like preprocessors. But that's just an opinion. I think
| I'll extend abcpp to add m: support.
|
| That said, if all developers are willing to implement m: in their
| programs, that't fine. Otherwise, abcpp will do the job for them.

Macros are usually best handled by  a  separate  pass  that
just expands them.  One of the interesting things about the
history of C is that there were  a  few  compilers  written
that had the macros integrated into the language.  This was
generally considered a bad idea.  In some cases, the  macro
code  was  stripped  out,  and replaced with a separate cpp
pass.

In the case of the C pre-processor, one of the  interesting
arguments  was  that the pre-processor is useful with a lot
of other languages.  If you look at C's macros, they really
have  little  to  do with C.  About the only syntax that is
really "C" is the /*...*/ comment; the rest is generic  and
works  with most other languages.  This was especially seen
when the Berkeley folks came out  with  the  compiler  with
multiple  parsers,  so  the  same  compiler could handle C,
Fortran and Pascal. New parsers could be (and were) written
as  plugins.  The macro phase was done first, so C's macros
could be used with all of the languages in the list.   Perl
has  an option to run the code through cpp.  So keeping C's
macros in a separate program is a  benefit  to  many  other
languages.

It's not obvious that abc macros would be  very  useful  to
anything  but  abc.   The  above  macro is pretty obviously
musical, and of  no  obvious  use  anywhere  else.   But  I
wouldn't  be  too  surprised if people found other uses for
it.  In any case, one of the vague and general lessons from
the  field  of  computing  is  that  things  that  do  text
transformations like this are often more  useful  than  you
think  at  first.   They  are  best  done  with  standalone
programs, so you can easily retarget them.  You can  invoke
them  by  default (as C compilers do) or with an option (as
perl does), but you probably  don't  want  them  integrated
into your other programs.

To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html

Reply via email to