Should go in a blog .. :-) I see 4 ways to manage statement grouping:
1. SC: Commands target a single statement, provide compound construction: if (x) y if (x) { a; b; c; } 2. RP: Commands target rest of program, provide parens: begin let x = y in a; b; c end; e 3. T: Command requires terminator if x then do y; z; done 4. 2D language: if x: a b e Pros and Cons Methods 3 and 4 provide seamless transition from 0 to N lines, so insertions and deletions are entirely local. With 1 or 2, the compound or paren form has this property too, but form transitions require non-local editing. Method 2 is worse than 1, because the leading paren encloses the whole statement, not just the target group. Method 3 has the worst display properties, since it mandates many trailing terminators for multi-nested blocks. Method 2 has the best display properties, because different kinds of parens may be allowed, so multiple termination can be reduced to a single symbol. Method 4 can be extended eg Python: if x: a; b; c however like all 2D languages it has trouble coping with long lines. In this modified form the seamless editing advantage is lost in favour of compaction. Some languages, eg C, Felix, mix these methods. Similar issues arise with say, tuples, where Python actually allows: (1,2,3,) so you can use the separator as a terminator. Python is also really cool in that it works well with folding editors. However it doesn't play so well with linear parsers, and the rigid style can be visually wasteful. In Felix at present I chose method 3, with permission to elide terminator in a few places where parens can be used instead. however in loop and condition heavy code up to half my lines can be wasted on terminator symbols. Unlike Scheme and C Felix terminators are fat (done, endif, endmatch). A terminator like "-" might be better. For example: for i in x do for j in y do a; - - Here, i indent with 2 spaces and I can do multiple terminations on a single line, and also have the terminators line up with what they terminate. Equivalent to C: for () { for () { stuff } } and not bad like this either: for () { for () { stuff; } } Here, the { and } are aligned, although they're not paired in the same column: you have to read the } } backwards.. I have no good ideas here. 2D languages are clearly the cleanest: they work best visually and also provide seamless editing, but they can be wasteful without allowing one line forms, which somehow puts them back into the same problems the free form syntax has. Mixing models provides the best compaction and editing combinations -- and also the worst ones, as well as being hard to learn. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_123012 _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language