On Thursday, 11 April 2019 at 06:20:05 UTC, Julian wrote:
Hello,

When reading through the following D blog post, I noticed in the
feature chart that D had "Arrays beginning at arbitrary indices" as
a +1 feature, the same as in Ada.

https://dlang.org/blog/2018/06/20/how-an-engineering-company-chose-to-migrate-to-d/

That surprised me, and from the code with the blog, that seems to be
generous.

[...]

Is there a nicer way to have enum array keys in D?

No. I've myself written my own EnumIndexedArray [1] type. It's pretty simple. Just a couple of operator overload to preovide the syntax.

I went from ObjFPC/Delphi which has what you describe from Ada too and missed it. (typically: `enum TStuff = (); var stuffStrings: array[TStuff] of string;` ...)

[1] https://github.com/Basile-z/iz/blob/9ce6fc0e2e0c74f97d530ce598a6842b7b048f25/import/iz/enumset.d#L1086

Reply via email to