[nem-en] Metaphor, staging, typed reflection
Kamil Skalski
kamil.skalski at gmail.com
Sat Jan 6 20:39:30 CET 2007
Quite interesting paper - it's nice to see that people are
incorporating meta-programming concepts into commonly used frameworks
and in addition in fairly clean way. :-)
To compare this system with Nemerle you need to know a few core differences:
- Nemerle is not statically-typed meta-programming system, it uses
untyped code expressions, which are interpreted (and type-checked)
during compile-time when they are used
- our system is two-staged and second stage is executed during compile time
This has several implications:
- we do not need to care about types during writing of code
expressions, so we have considerably more flexibility here and the
main point of the paper is incompatible with our system - they
provided mechanism for making C#/Java reflection more type-safe, but
we do not need this
- you can do the same stuff you would write in Metaphor, but using
information provided by compiler not by reflection (see Serializer
example from our tutorial and compare it with paper
http://nemerle.org/Macros_tutorial#Manipulating_type_declarations)
- using the (not really stable / complete / often used) code evaluator
provided by Nemerle compiler library you can execute code expressions
at runtime (thus approaching to multi-stage system), but sure - here
we do not have static type-safety provided by first compilation
So, in short, there are two goals of Metaphor:
- extend C# with meta-programming - it is very nice, we do the same
but with different (IMHO more flexible, but less "scientific")
approach
- "In combination they enable a programmer to write statically-typed
programs that dynamically generate code based on the structure of
types." - I don't really see reason to dynamically (based on
reflection) generate statically-typed programs... if you are doing
something dynamically, it is not really important that part of your
job is a little bit statically checked. We do all this at
compile-time, which allows you to inspect generated code and in
contrast is more flexible than Metaphor approach.
I hope this answers you question well.
2007/1/6, Sandro Magi <smagi at higherlogics.com>:
> I recently came across the Metaphor language for .NET, and thought
> people on this list might find some of its features interesting:
>
> http://sky.fit.qut.edu.au/~neverov/metaphor/
>
> * small extension to C#
> * safe multi-stage programming
> * statically typed, runtime type analysis, ie. reflection
>
> Would Nemerle's macros be powerful enough to encode the staging and
> runtime type analysis? I imagine it would be quite complex, but is it
> doable in principle?
>
> Sandro
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
--
Kamil Skalski
http://nazgul.omega.pl
More information about the devel-en
mailing list