compile time class introspection?
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Fri Jun 15 03:10:29 PDT 2007
Serg Kovrov wrote:
> Back to subject, how about define an intuitive syntax for compile time
> checking if method exist in a class/structure?
How about waiting until macros are implemented (as fairly recent posts
by Walter have indicated they will be), and then creating one that
replaces something like 'hasmember(a.foo)' or 'hasmember(a, foo)' with
"is(typeof(&a.foo))"? :)
I think macros will be a very powerful mechanism to give things that are
already possible in the language a more intuitive or simple syntax
without special handling by the compiler being necessary.
Lisp programmers make very good use of this, IIRC (within the
constraints of S-expr syntax, of course :P).
More information about the Digitalmars-d
mailing list