We all know how nice well-written idiomatic D code looks, but I think it's time that we try to really explore the full power of the language.

To further this goal, I've started the Idiotmatic D repository on Github. It is a place where we do not just ask, "What should we do?, but also ask, "What CAN we do?". I aim to create examples of clean-ish idiotmatic code for those new to D to follow (at their own peril).

The rules are simple: The code does not have to run, but it does have to compile.

Contributors are encouraged to do things like look at the Declarations page of the language reference and ask themselves "Does this mean that I'm allowed to _____?" where the blank is filled in with a really bad idea.

For instance the code:

alias double ["a" .. "whatever"] ( * foo []) [123.45f];

is both syntactically valid and banned by international war crimes treaties.

Does the spec let you do it but the compiler stops you? Leave it in, but commented out.
Does the spec let you do it and the compiler agrees? Good.
Does the spec disallow it but the compiler doesn't even issue a warning? Excellent.

https://github.com/Hackerpilot/Idiotmatic-D

Reply via email to