Hacker News new | ask | show | jobs
by IReadYourCode 4459 days ago
It's finally a syntax that doesn't get into your way when you want to generate stuff.

Think of XSLT. Every time you want to generate a "<" or ">" you need to escape it.

Think of PHP. Every time you want to embed a command you need at least two characters to escape it: <? ?>

Xtend choose «guillemets» because they're concise and very unlikely to occur in the string/text/file your generating. You might want to use UTF-8 or ISO-8859-1 encoding.

2 comments

<? is easier to type and no harder to read than «.
Sure, until you are trying to generate php.

The templating engine is one of the parts carried over from the old Xpand project on which Xtend is based. Xpand's sole purpose was as a templating language for writing code generators in MDE projects, and as such they tried to make it easy to generate any kind of code, so they chose a non-ASCII delimiter.

It's really not a problem in practice - type < and then ctrl-space and code completion will fill it in for you. The only real gotcha is that you have to make sure your project is set to use UTF-8 encoding, which unfortunately is not the default setting in Eclipse.

I can't find « » on my keyboard :(
If you press CTRL+SPACE the Eclipse content assist will insert a pair of « ». This only works when « » are valid, i.e. between ''' and '''.

Wikipedia has a nice list of key combinations for each OS/language/keyboard: http://en.wikipedia.org/wiki/Guillemet#Typing_.22.C2.AB.22_a...