[dmd-beta] dmd 1.074 and 2.059 beta 5

Jonathan M Davis jmdavisProg at gmx.com
Tue Apr 10 17:12:50 PDT 2012


On Wednesday, April 11, 2012 02:03:55 David Nadlinger wrote:
> I am not quite sure about the best way to fix this particular problem
> – from trying to figure out a way to get the Thrift code working with
> current Git master it seems that DMD more or less no longer allows
> adding something to a type based on its current members.

I honestly would have never expected anything like that to work. You can't 
normally do anything with a type until it's been declared, and if you're doing 
anything that requires knowledge about more than the type's name, then it has 
to be defined before you can do that. Examining it as you're constructing it 
goes against that, though clearly you've found use cases where it would be 
useful.

> It is clear
> that the semantics of this must be carefully defined, but it is useful
> for certain »declarative« kinds of meta-programming (especially due to
> the lack of something like ADL allowing you to »associate« code with a
> type in another way), it worked in previous DMD releases, and now fails
> in confusing ways. Maybe we finally need to sit down and formalize our
> forward reference model (perhaps along the lines of the proposal that
> came up some time ago – was it by Don? –, for doing semantic
> analysis one layer of conditionals at a time).
> 
> The underlying problem is really that as a developer doing
> metaprogramming-heavy stuff, you have no idea what actually is supposed
> to work, and after you found out the hard way by testing what DMD
> accepts, you still don't know whether it will continue to work in future
> releases. And this is a much bigger problem than e.g. breaking standard
> library changes, because you can easily work around the latter.

I agree. The semantics need to be clearly defined. And this is particularly 
critical in metaprogramming-heavy code.

- Jonathan M Davis


More information about the dmd-beta mailing list