On Saturday, 30 May 2015 at 08:22:21 UTC, Martin Nowak wrote:
On Saturday, 30 May 2015 at 00:50:39 UTC, Steven Schveighoffer wrote:
I suggest first we build a library AA that sits beside real AA, even if it doesn't . Then we create a test suite to prove that the library AA can be a drop in replacement. Then replace it :)

Writing the AA is NOT the problem, but I doubt we can get compatible enough to replace the built-in AA. Rather it'll require to deprecate a few built-in AA semantics and adding operator and literal extensions for the library type. Hence the proposal to start with a HQ library AA and incrementally converge them.

My idea is slihtly of topic.
I thiking about some API for array and associative array literals. Something similar to our range API: front, popFront, etc. It would be good (as I think) if programmer could be able to use Array, or AA literal directly (like maybe initializer list in C++). So for example some class or struct could be initialized from AA literal directly. And another option could be having heterogenous types in Array and AA, so we could use them in a way we work with tuples. So we could use AA literal to initialize JSON objects directly for example using different types of values inside.

auto json = [ "name": "John", "age": 30, "interests": ["programming", "D lang"] ];

Also we could be able to initialize tuple from such heterogenous Array literal. So literals would be not only available for processing by core language and runtime, but also for regular D classes, structs and templates. It could significantly help with initializing complex objects. It would be big change. But what do you thing about just about idea?

Reply via email to