Alternative /hipster/ syntaxes for D

ezdiy eezdiy at gmail.com
Thu Mar 29 02:47:54 PDT 2012


Hello,

D syntax being C-ish one is great for oldschool class of 
programmers coming C/C++/Java/C# backgrounds, and although it's 
quite conscise one compared to, eg. javas, it's still much on the 
overly verbose side for some people (ie. at least for me :)

The question is, how one would go around to successfully 
implement an alternative modern syntax to "fix" this. Are there 
some attempts out there?

I'm talking among the lines of translators for popular languages 
such as Lua (http://moonscript.org/) or Javascript 
(http://coffeescript.org/). For statically typed example, take a 
look at http://live.gnome.org/Genie for Vala.

My idea is something like: try to keep as much of original D 
grammar as possible, but add a lot of syntactic sugar, f.e.:

- strip perceived "bloat" - by default, all variables auto, only 
basics of OO (everything virtual and public..) exposed etc...
- python's indentation blocks, instead of {}
- line decorators, such as: a = b if c
- multiple return values (either hack the compiler to have em, or 
add *a lot* of boilerplate to the translator to use tuples)
- your ideas?

Another issue is how to go around implementation. My bet is to 
start with some already existing 1:1 D translator which has an 
actual AST state (is there something like that?) and then try to 
retrofit it with as much of the hipster stuff until things start 
to get overly ambiguous :)


More information about the Digitalmars-d mailing list