On Sunday, 12 January 2014 at 11:32:00 UTC, Daniel Murphy wrote:
It's not _that_ bad. There are open pull requests to convert AAs to use UFCS instead of the current broken hacks, and crossing from compile to run-time just means matching the layout of the runtime AAs in AssocArrayExpression::toDt.

Alright, that looks more short-term viable than Stepanov's approach. I don't think I'm overplaying the issue though - it is a tall order to ask for compile-time construction of AAs that are then usable at runtime, and it's not fair to present them as a fundamental feature, or their absence as a bug, because it's not like other languages have anything near this kind of power.

It props up quite often but it's usually due to a (perfectly understandable) misunderstanding of D's initializers for fields and module-level/static variables. The expectation is that it works like in Java and C#, where these initializers are run before main or on construction of the type. Fortunately, when the D approach is explained, thus explaining why the code errors[1], most people tend to be either content or excited.

[1] The error message was fine for D1, but the phrasing is problematic for D2...

Reply via email to