Lambda the Ultimate

inactiveTopic Confused about what Macros could be.
started 3/1/2003; 11:33:16 AM - last post 3/3/2003; 12:26:27 PM
M.J. Stahl - Confused about what Macros could be.  blueArrow
3/1/2003; 11:33:16 AM (reads: 311, responses: 1)
I have recently started on working on a new language. This isn't a academic project, or a corporate endevor. Its more or less a project to keep me happy with programming in a language I want to use.

I have had recent thoughts on the inclusion of macros.

The ideas running through my head so far is to treat functions and macros the same on the definition side, but changing the way they are invoked/used by the programmer.

Basically I am looking for the ability for every function to have the capabilities of being treated like a macro.

a basic syntax (in no particular language) may look something like this:

define-function foo: x, y # define function 'foo', passing x and y as arguments .....

foo: x, y # invoke function 'foo'.

@foo: x, y # invoke foo as a macro

I have been told by some others that my problem with lie within my use of infix operators, and I may have a lot of the macro complexity problems that Dylan has (which I am still doing research on).

I guess I wanted to do this to avoid, what I thought to be, fluffy syntax (in reference to Scheme) with such functions as define, and define-syntax. I wanted one way to define a group of expressions, and then later on decide how I wanted those expressing to be evaluated... hence the ability to invoke said procedure as a function, or a macro.

Any help provided by yourself or the LtU community, would be most appreciated.

Best regards,

M.J. Stahl

water - Re: Confused about what Macros could be.  blueArrow
3/3/2003; 12:26:27 PM (reads: 307, responses: 0)

In Slate, we do something relevant. Macros are methods defined on the abstract syntactic types of a language (Slate, by default, of course), and macro-calls are the same as method-invocations, only preceded by the back-tick (`).

We acheive what you are attempting through an "`evaluate" macro which can be applied to any expression. And, yes, we do use infix syntax, but our approach does not seem to lead to the problems that have been mentioned about Dylan.