dmd 1.042 and 2.027 releases
Christopher Wright
dhasenan at gmail.com
Wed Apr 1 16:21:29 PDT 2009
Charles Hixson wrote:
> bearophile wrote:
>> davidl:
>>> why not make opDot some compile time stuff?
>>
>> You mean run time.
>>
>>> this can be particular useful for COM
>>
>> And GUIs, I guess. It smells of Object-C++, but the syntax is nicer.
>> But such runtime code must be not included into the executable if this
>> feature is nowhere used in the code. D executable are already quite
>> big enough.
>>
>> Bye,
>> bearophile
> Syntax and lack of garbage collection is why I never seriously
> considered Object-C++.
>
> Seriously... It's important to be able to write code that can be
> optimized at compile time...and it's also important to be able to write
> code that can be dynamic at run-time. D has been lacking in the second
> set of capabilities, though it's been dynamite at the first.
>
> ... After saying this I started thinking a bit more. D is more dynamic
> that we normally give it credit for, but the syntax for dynamic
> interaction is painful, so it tends not to be used.
What dynamic features would be useful?
D has:
- get an opaque reference to a type
- get the name of a type
- get a smattering of other information about a type
- polymorphic method dispatch
- safe casts
- constructing objects with default constructors by reflection
The other common dynamic/reflection type stuff:
- getting information about fields and methods
- getting and setting fields
- invoking methods by reflection
- constructing objects by reflection, even if they don't have default
constructors
Walter says you can do everything here using compile-time reflection.
That's true, but it doesn't suffice, I think. You need something like
Jascha Wetzel's ClassInfoEx in the standard library. I'd be willing to
write such a thing, if it would be accepted. (ClassInfoEx has no license
information included in it, and Jascha is not around, so it cannot be used.)
But it _has_ to be in the standard library. Additionally, it can't incur
greater costs to mix it in multiple times -- it should be idempotent.
More information about the Digitalmars-d-announce
mailing list