>Does anybody know whether any other language supports
>macros except Lisp and Scheme ?
I think Perl programmers call them "source filters." They tend not to
work as well in Perl, though, because macros depend on uniform syntax
(which Lisp has and Perl doesn't). Also, I don't really know enough
about Perl source filters to say if they are on the same level as Lisp
macros.
http://www.theperlreview.com/Interviews/mjd-hop-20050407.html
On 18 Apr 2005 12:25:23 -0700, "Rahul" <··········@gmail.com> wrote:
>Does anybody know whether any other language supports macros except
>Lisp and Scheme ?
Apparently Dylan (with an infix syntax) does. See Jonathan Bachrach's
work on "Dylan Procedural Macros".
http://people.csail.mit.edu/people/jrb/jrb.html
Fernando Rodriguez wrote:
> On 18 Apr 2005 12:25:23 -0700, "Rahul" <··········@gmail.com> wrote:
>
>
>>Does anybody know whether any other language supports macros except
>>Lisp and Scheme ?
>
>
> Apparently Dylan (with an infix syntax) does. See Jonathan Bachrach's
> work on "Dylan Procedural Macros".
> http://people.csail.mit.edu/people/jrb/jrb.html
Dylan was designed to be a Lisp with an infix syntax, so using that as
an example is cheating.
There are plenty of non-Lisp languages with macros, but none of them
have macros that are as simple to understand while still being as
powerful as Common Lisp's. For example, C++ has two macro systems --
the C preprocessor and templates. CPP is simple, but can only do string
munging, while templates are as powerful as Lisp macros, but have the
most convoluted design I've ever seen. What makes Lisp unique is not
that it has macros, it's that it has GOOD macros.
-- MJF
Rahul wrote:
> Does anybody know whether any other language supports macros except
> Lisp and Scheme ?
"Growing Languages with Metamorphic Syntax Macros"
Claus Brabrand and Michael Schwartzbach; PEPM'02 (2002)
<http://www.brics.dk/bigwig/publications/macro.pdf>
--
Jens Axel Søgaard
Rahul:
| Does anybody know whether any other language supports macros
| except Lisp and Scheme ?
Mathematica, somewhat.
--
Sebastian Stern
Freedom is the freedom to say (= (+ 2 2) 4). If that is granted, all else
follows.
OCaml (http://caml.inria.fr/index.en.html) has camlp4, "a
Pre-Processor-Pretty-Printer for Objective Caml. It offers tools for
syntax (grammars) and the ability to modify the concrete syntax of the
language (quotations, syntax extensions)."
Nemerle (http://www.nemerle.org) has macros.
"You can think about macros as of a system of compile-time
transformations and automatic generation of code with regard to some
rules. It can be used either to automate manipulations performed on
similar data-types and fragments of code or to add syntax shortcuts to
the language, optimize and make some computations safer by moving them
from runtime to compile-time.
The idea of making simple inline operations on the code comes from
preprocessor macros, which many languages (especially C, C++) have
contained since early times of compiler design. We are following them
in the direction of much more powerful, and at the same time more
secure (type-safe) solutions like Haskell Template Meta-programming. "
Io (http://www.iolanguage.com) claims
"Io is small prototype-based programming language. The ideas in Io are
mostly inspired by Smalltalk (all values are objects), Self,
NewtonScript and Act1 (prototype-based differential inheritance,
actors and futures for concurrency), LISP (code is a runtime
inspectable/modifiable tree) and Lua (small, embeddable)."
Not sure if the "runtime inspectable/modifiable tree" qualifies as
macros, I've looked but never seen an example of this modification.
On 18 Apr 2005 12:25:23 -0700, you wrote:
>Does anybody know whether any other language supports macros except
>Lisp and Scheme ?
"Rahul" <··········@gmail.com> wrote:
>Does anybody know whether any other language supports macros except
>Lisp and Scheme ?