Re: [Pharo-users] question on syntax "negate numbers"

2014-11-22 Thread Nicolai Hess
2014-11-22 13:23 GMT+01:00 Werner Kassens : > >Thanks for all the answers, > >so, for better portability, maybe we should dissallow opals current > behavior > >and only accept "-5" and not "- 5" as negative numbers? > > Hi Nicolai, > perhaps. if you mean portability pharo->otherLanguage certainly.

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-22 Thread Werner Kassens
>Thanks for all the answers, >so, for better portability, maybe we should dissallow opals current behavior >and only accept "-5" and not "- 5" as negative numbers? Hi Nicolai, perhaps. if you mean portability pharo->otherLanguage certainly. if you mean otherLanguage->pharo, well you are the sp

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-21 Thread Nicolai Hess
2014-11-10 12:47 GMT+01:00 Werner Kassens : > >3 @ - 5 is what I object to (and Opal allows) > with this i have no problems, it follows simple obvious rules as long as > one knows that #@ cant be an unary operator. > >is 4 - 5 two literals, or is it two literals separated by the - operator ? > bu

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-12 Thread Werner Kassens
On 11/12/2014 11:29 AM, José Comesaña wrote: > Well, I don't understand why the book says that because in fact you can > define a -- binary method: yes, that is what i said, it's just an irritating bug in the book. werner

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-12 Thread José Comesaña
> > "Note that −− is not allowed for parsing reasons" (i just checked the > latest version) > now honestly, dont you think that a) is a serious contender? that is all i > wanted to say. > werner > Well, I don't understand why the book says that because in fact you can define a -- binary method: Sm

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-10 Thread Werner Kassens
dont know but let me try yet another attempt at rephrasing this. suppose you ask an intermediate beginner how 5--4 would be parsed, as: a) 5 - -4 b) 5 -- 4 perhaps he does not need to look up the chapter in the pharobook and will choose b). but if he looks into the pharobook he will read under

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-10 Thread Thierry Goubier
2014-11-10 15:57 GMT+01:00 Werner Kassens : > Let me restate what i meant: if you enter 5--4 in squeak for example, the > parser asks you whether you meant 5 - -4 or 5 -- 4. Oh, ok. And what happens if you are not in an interactive mode (like when you are filing-in code) ? Thierry > > werner

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-10 Thread Werner Kassens
Let me restate what i meant: if you enter 5--4 in squeak for example, the parser asks you whether you meant 5 - -4 or 5 -- 4. werner On 11/10/2014 03:28 PM, Werner Kassens wrote: Of course. i was talking about x -- y not x - - y. werner On 11/10/2014 03:17 PM, Thierry Goubier wrote: I believe

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-10 Thread Werner Kassens
Of course. i was talking about x -- y not x - - y. werner On 11/10/2014 03:17 PM, Thierry Goubier wrote: I believe that x - - y would give you an error. 4 - - 5 in parsing is a different beast, because you consider - 5 as a single token.

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-10 Thread Thierry Goubier
I believe that x - - y would give you an error. 4 - - 5 in parsing is a different beast, because you consider - 5 as a single token. Thierry 2014-11-10 12:36 GMT+01:00 Henrik Johansen : > In VisualWorks: > 3 @ *Argument expected ->*- 5 > > I guess what one expects is a matter of habit, personal

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-10 Thread Werner Kassens
>3 @ - 5 is what I object to (and Opal allows) with this i have no problems, it follows simple obvious rules as long as one knows that #@ cant be an unary operator. >is 4 - 5 two literals, or is it two literals separated by the - operator ? but then there is no situation in which the - operator

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-10 Thread Henrik Johansen
In VisualWorks: 3 @ Argument expected ->- 5 I guess what one expects is a matter of habit, personally I'd expect x - - y to yield a parsing error. Cheers, Henry > On 10 Nov 2014, at 12:06 , PBKResearch wrote: > > I have tried this on my latest Dolphin (Pro 6.1 Beta 2): > 3 @ -5 is accepted an

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-10 Thread PBKResearch
I have tried this on my latest Dolphin (Pro 6.1 Beta 2): 3 @ -5 is accepted and interpreted correctly. 3 @ - 5 is rejected with message: 'Error - incorrect expression start'; the caret is pointing at the - sign. So the Opal behaviour does not mirror that of Dolphin. Hope this helps Peter

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-10 Thread Thierry Goubier
2014-11-10 8:47 GMT+01:00 Henrik Johansen : > 3 @ -5 is not a problem, and accepted by both. > 3 @ - 5 is what I object to (and Opal allows) > RBParser allows this one even if old Compiler dissallows it (i.e. in Pharo 2). I haven't tracked if Opal follows the RBParser on that or if this is the

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-09 Thread Henrik Johansen
> On 10 Nov 2014, at 8:45 , Thierry Goubier wrote: > > > > 2014-11-10 7:59 GMT+01:00 Henrik Johansen >: > > IMHO, the old compiler is right, whitespace should not be allowed in literals. > > Whitespace can be \t or \n,\r which makes for strange literals

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-09 Thread Thierry Goubier
2014-11-10 7:59 GMT+01:00 Henrik Johansen : > > IMHO, the old compiler is right, whitespace should not be allowed in > literals. > Whitespace can be \t or \n,\r which makes for strange literals (multilines) such as: - 5 And would create ambiguity in some cases is 4 - 5 two literals, or is it

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-09 Thread Henrik Johansen
> On 08 Nov 2014, at 5:55 , Werner Kassens wrote: > > but if you omit the space between - and 3 the old compiler understands it > too, hence its just a convenience thing that cant lead to misunderstandings, > or? > btw opal also understands this: > -3@2. --> (-3@2) > i mean, its obviou

Re: [Pharo-users] question on syntax "negate numbers"

2014-11-08 Thread Werner Kassens
but if you omit the space between - and 3 the old compiler understands it too, hence its just a convenience thing that cant lead to misunderstandings, or? btw opal also understands this: -3@2. --> (-3@2) i mean, its obvious nevertheless that "-" is not a method like negated, but part of