|
[jira] Commented: (BOO-496) Allow for compact statements for block-based ex: msg#00095lang.boo.devel
[ http://jira.codehaus.org/browse/BOO-496?page=comments#action_47175 ] Doug Holton commented on BOO-496: --------------------------------- If this is ever wanted, changing the compound_stmt rule in boo.g to this appears to allow it: protected compound_stmt[Block b] { StatementCollection statements = b.Statements; }: (COLON (EOS)* stmt[statements]) | ( COLON begin:INDENT { b.LexicalInfo = ToLexicalInfo(begin); } block[statements] end[b] ) ; Some simple examples: if true: print "ok" if false: print "true" else: print "false" try: raise "uh oh" except e: print "caught it" > Allow for compact statements for block-based expressions > -------------------------------------------------------- > > Key: BOO-496 > URL: http://jira.codehaus.org/browse/BOO-496 > Project: Boo > Type: Improvement > Components: Compiler > Versions: 0.6 > Reporter: Arron Washington > Priority: Minor > Fix For: 0.7 > > > Some discussion on the list - the tail end of this thread: > http://groups.google.com/group/boolang/browse_frm/thread/ac20f7172255287e/99ea344d11fe6bc6#99ea344d11fe6bc6 > - brings up something in general that I think a lot of people might like: > while true: print 'var'; print 'hello' > or, as mentioned in the thread, > if false: print 'empty codeblock' > Sometimes its not really necessary to consume that much space if there's only > going to be one or two elements within the block. Othertimes its just easier > to expand a statement like that into a fully block-based statement with a > little hassle. > Note: this is not a proposal to remove the "print 'foo' if bar" syntax; this > is just a more general way of allowing compacted block-based > statements/expressions/technical jargon. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [jira] Created: (BOO-495) ProtectedProperty Attribute, Sorin Ionescu |
|---|---|
| Next by Date: | [jira] Updated: (BOO-495) ProtectedProperty Attribute, Doug Holton (JIRA) |
| Previous by Thread: | [jira] Created: (BOO-496) Allow for compact statements for block-based expressions, Arron Washington (JIRA) |
| Next by Thread: | [jira] Commented: (BOO-496) Allow for compact statements for block-based expressions, Arron Washington (JIRA) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |