[PROPOSAL] Disallow // and \\ in Slang code (was: Re:
Squeakarcheology - quo vs. //)
Dan Ingalls
Dan at SqueakLand.org
Wed Apr 7 18:48:11 UTC 2004
>From Bert and Andreas -
> > How about we disallow // and \\ in the Slang translator to make sure
>> that anyone using it is aware of the differing semantics? We would
>> introduce #div: and #mod: generating explicit code rounding towards
>> negative infinity and use #quo: and #rem: to get the C99 meaning. The
>> error message when translating code with // or \\ should explain the
>> difference, and point out that in most cases one will want to use #quo:
>> or #rem:.
>
>I partly like and I partly dislike this idea. Here is an alternative:
>
>a) To more easily remember the names (I find #quo: and #rem: impossible to
>remember) let's define #div: and #mod: instead as an extension for VMMaker
>and fix the code to consistently use #div: and #mod:. This allows to
>*define* the meaning of division in whatever way we decide.
It seems simpler just to stick with (and enforce) quo: and rem: in the Interpreter. No new names (will add to the confusion, even if it helps some people), simple error if you use // or \\.
> > What this buys us is that we can rely on the simulator doing the same
>> as the Smalltalk code. Which is important, IMHO.
>
>I think it's more than that - I think it's critical.
I agree. It's a terrible bug.
If you feel strongly about adding new names, go ahead.
- Dan
More information about the Squeak-dev
mailing list
|