On 2012-01-31, at 4:38 pm, Steve King wrote:
On 2012-01-25 04:00, Allan Odgaard wrote:
An example where this makes sense would be:
if(true) while(false) for(size_t i = 0; i< 10; ++i) continue; return 0;
I don’t think TextMate 1.x is able to properly indent the above, but 2.0 will, even while you type it.
The downside of the line-based rule system is that breaking one statement across multiple lines is effectively unsupported, since each fragment is matched against the patterns and will thus be wrongly classified. I don’t know how this can be improved (other than do binary parsers for each language, but even that is quite a challenge for languages like C++).
If it's a choice between supporting code like your example or supporting a single statement split across lines, I say focus on the multi-line statement. Anyone who writes deeply nested C (or C-like) code without braces needs to be whacked upside the head with a cluestick, not encouraged by their editor.
In fact, I'd pay ten times as much if TextMate could be made to deliver a high-voltage electric shock to anyone who tried writing such an abomination! Call it something catchy like InvisibleCodeFence and you'll sell a million copies.
IMNSHO, of course. :-)
While it's cool that a language allows someone to write code like that - and I've done my fair share of it in the past, I would also hate to be the next guy who needs to debug or edit it especially if the indentations get fubar'd for whatever reason. Legibility rules especially once your prescription goes over -4 diopters.
Ed Wong