From: Jeremy Tregunna Date: 2006-10-06T03:33:35+09:00 Subject: Re: [OT] Re: dynamically changing superclass/mixins On 06-10-05, at 14:23, ara.t.howard@noaa.gov wrote: > On Fri, 6 Oct 2006, Jeremy Tregunna wrote: >> >>> is the parse non-ambiguous as >>> (method a, a * a) call 5 ; otherStuff >> >> I'm not exactly sure what you're after here. The snippit of code >> in question isn't ambiguous. > > i meant, how many parens can you omit? You can only omit parens for operators. However, you can dynamically add operators at runtime. Such as: Message OperatorTable rightOperators atPut("call", 4) // gives "call" a precedence of 4 Then you could write: method(a, a * a) call 5; doStuff and Io parses it as such: method(a, a *(a)) call(5); doStuff However, this isn't generally recommended as it then brings operator precedence into the picture and you may be a little bit surprised as to how things get parsed then. I.e., if you wanted to calculate the value of 1 + 5 and then the factorial of that result, and you write: 1 + 5 factorial You'd be in for a shock as that would be parsed to 1 +(5 factorial). You'd need to either explicitly group 1 + 5 such as (1 + 5) or give the parens explicitly to addition such as: 1 +(5). I personally don't like operator precedence, it only complicates things, but that's a bikeshed for another list. =D -- Jeremy Tregunna jtregunna@blurgle.ca