Meta information parser
pragma
pragma_member at pathlink.com
Mon May 29 19:31:16 PDT 2006
In article <e5fgqn$vrs$1 at digitaldaemon.com>, Sjoerd van Leent says...
>
>any ideas on this?
I think you already touched on the high-points, but I'll throw some more wood on
the fire as you covered a lot of very interesting ground.
In-code metadata is only really as useful as one can access it. I've used it in
C# to implement some really slick seralizers and such - the kind of things that
make standards like CORBA easy to integrate with. I agree with you completely.
Sadly, without a completely reflective runtime, an implementation backed on what
D is right now wouldn't hold a candle to other languages and platforms. With
that in mind, it's kind of premature to even suggest a particular way to go
about this as D simply isn't ready for it yet. :(
But were that superior reflection interface here, I'd advocate the use of
pragmas for denoting attributes, as it would make parsing the attributes out
easier to implement.
Now I do like your idea behind code injection - I've thought about this one too.
Personally, I think a runtime "code emit" interface would make a very nice
complement to a fully-fledged reflection interface. AFAIK, there is *nothing*
keeping anyone from coding one up right now as a standalone lib; provided they
understand enough about x86 ASM, the unerpinnings should be the least
problematic part. Desigining things to be portable between Unix and Windows,
and finding somone to provide PPC support would be the biggest set hurdles to
clear. If it helps, I think something more along the lines of C#'s emit
interface may be easier to implement than the more sourcecode heavy example you
cited earlier simply because it eliminates the need for a parser.
I'll also add that a runtime emit interface is a step in the right direction
toward creating a self-hosted "D compiler toolkit" of sorts. The kind of thing
anyone could use to create quick and simple code generators for all kinds of
purposes, without need for the DMD toolchain to be installed along with your
application.
- EricAnderton at yahoo
More information about the Digitalmars-d
mailing list