Arc Forumnew | comments | leaders | submit | vsingh's commentslogin
1 point by vsingh 6439 days ago | link | parent | on: The real problem with unhygienic macros

Hmm.

I guess the macros in the form are expanded with reference to the context of the entire form (the global context).

Does this mean we don't have macrolet?

-----

1 point by simonb 6439 days ago | link

It probably has more to do with if being one of the primitives (or axioms if you will).

-----

6 points by vsingh 6439 days ago | link | parent | on: The real problem with unhygienic macros

This just made me notice something interesting.

This works:

    (eval (list 'oaf 1 2))
    2
But this does not:

    (eval (list oaf 1 2))
    Error: "Bad object in expression #3(tagged mac #<procedure>)"
In other words, you can't evaluate a form in which the car is the actual macro object itself, rather than the name of a macro. If we could make that work, we could solve your problem by inserting the macro objects we want where we want, in effect telling Arc which version of 'oaf' we want in advance.

It would make macro expansions pretty ugly to look at, though.

-----

9 points by pg 6439 days ago | link

In other words, you can't evaluate a form in which the car is the actual macro object itself

The single biggest compromise I had to make because of MzScheme was not being able to put objects like functions and hashtables into macroexpansions. I don't know if I would have wanted to do what you tried to, but in other ways I'm constantly inconvenienced by this restriction.

You can do it in most CL implementations, though the spec is ambiguous on the matter.

-----

1 point by vincenz 6436 days ago | link

This was brought up before, namely here:

http://arclanguage.com/item?id=804

And there was a partial solution as well.

-----

2 points by akkartik 6439 days ago | link

This came up before: http://arclanguage.org/item?id=654

Why do you think it's ugly?

-----

4 points by vsingh 6439 days ago | link | parent | on: Technical Comments on Arc

"Where is macrolet?!"

Arc has first-class macros.

-----

1 point by wchogg 6439 days ago | link

First class? Really? As in I can pass in a macro anywhere I can pass in a function?

-----


The negative index syntax doesn't work yet, but for the rest of your example:

    (map "foobar" (list 0 2 4))
    (#\f #\o #\a)

-----