DeRailed DSL (was Re: compile-time regex redux)
    Thomas Kuehne 
    thomas-dloop at kuehne.cn
       
    Sat Feb 10 23:56:25 PST 2007
    
    
  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Andrei Alexandrescu (See Website For Email) schrieb am 2007-02-10:
> Bill Baxter wrote:
>> As for Andrei having Walter's ear.  I think Andrei has Walter's ear 
>> mostly because Andrei is interested in the same kinds of things that 
>> interest Walter.  I think everyone can tell by now that Walter pretty 
>> much works on solving the problems that interest him.   Right now (and 
>> pretty much ever since 'static if') the thing that seems to interest him 
>> most is metaprogramming.  Hopefully some day he'll get back to being 
>> interested in reflection.  But if he's really got the metaprogramming 
>> bug, then that may not be until after he's got D's compile time 
>> framework to a point where he feels it's "done".  But only Walter knows.
>
> There is a deeper connection between runtime reflection and compile-time 
> reflection than it might appear.
>
> In the runtime reflection scenario, the compiler must generate, for each 
> user-defined type, an amount of boilerplate code that allows symbolic 
> inspection from the outside, and code execution from the outside with, 
> say, untyped (or dynamically-typed) arguments.
>
> The key point is that the code is *boilerplate* and as such its 
> production can be confined to a code generation task, which would keep 
> the compiler simple. The availability of compile-time introspection 
> effectively enables implementation of run-time introspection in a library.
>
> For example:
>
> class Widget
> {
>    ... data ...
>    ... methods ...
> }
>
> mixin Manifest!(Widget);
>
> If compile-time introspection is available, the Manifest template can 
> generate full-blown run-time introspection code for Widget, with stubs 
> for dynamic invocation, the whole nine yards.
>
> This is nicer than leaving the task to the compiler because it relieves 
> the compiler writer from being the bottleneck.
Going the compile-time introspection -> boilerplate way is possible but not
the only solution for runtime reflection. Combining "dmd -L/DETAILEDMAP ...",
Flectioned's Symbols.scanOptlinkMap and existing TypeInfo solves 80% of the
boiler plate issue. The only remaining issue are non-static non-function
aggregate members.
I'm not arguing against powerful compile-time reflection, in fact I love it.
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFFzkanLK5blCcjpWoRAmQyAJ9jjnvuJgoyDzJ19m+6L7CrYRMMqwCfS8Dg
YjrAoiAUaV529PU6uFklVyw=
=QiMc
-----END PGP SIGNATURE-----
    
    
More information about the Digitalmars-d
mailing list