New syntax for string mixins
Don
nospam at nospam.com
Fri Dec 17 11:51:08 PST 2010
VladD2 wrote:
> Hi,
>
> I'm one of Nemerle developers.
Cool!
>> From an implementation point of view, the differences between Nemerle
>> macros and string mixins are mostly syntactic.
>
> You are deeply mistaken!
> I'd advise to study the Nemerle macro-system.
>
> You missed: pattern matching,
Yes, you've got me there. I've assumed that pattern matching, while a
major feature, is not fundamental to the Nemerle macro-system, but I may
be mistaken.
One obvious difference which *is* fundamental is that Nemerle macros
allow new syntax.
Am I correct in thinking that Nemerle always requires complete ASTs?
That is, given a name "x", can you access variables "x1", "x2", "x3" ?
> quasi-quotation,
No, that's present in D. It's the primary reason I say that the
differences are mostly syntactic, since I see this as THE fundamental
feature. You need to be able to reenter the macro system after you have
left it. Once you can do that, you can do pretty much anything.
BTW if you argued that D's current syntax is quite horrible, I couldn't
disagree with you.
> running of fully functional Nemerle
> code in compile time,
Yes, but that's a different issue. In D, running code at compile time is
regarded as an aspect of constant-folding, and is not restricted to
macros.
> access to compiler API in macros
In practice, has to be a library, right? Otherwise the compiler
internals would be exposed? (This is an issue we're struggling with).
Another one of the big differences is that D doesn't allow compile-time
code to call external functions. Although it could certainly be done, it
raises some big issues. Eg, we cannot assume that the target CPU is the
same as the one we're running on. With a JIT compiler, you don't have
that problem.
> and IntelliSense support.
I did mention that...
>> The one thing about them that I find really impressive is the IDE
>> integration, especially that they got syntax highlighting to work.
>> I don't know they've done that.
>
> "syntax highlighting" ? :)
> We have full IntelliSense support: syntax highlighting, code completion, macro
> expansion (in tooltips).
I meant Intellisense, not just syntax highlighting. Though note that you
can't do syntax highlighting *perfectly* unless the IDE understands the
code.
> We simply use the Nemerle compiler to achive that.
Doesn't leave me any less impressed. <g>
More information about the Digitalmars-d
mailing list