[PROPOSAL] Disallow // and \\ in Slang code (was: Re: Squeakarcheology - quo vs. //)

Tim Rowledge tim at sumeru.stanford.edu
Wed Apr 7 16:49:02 UTC 2004


"Andreas Raab" <andreas.raab at gmx.de> wrote:

> > 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.
>
[snip]
Sounds plausible to me but we will have to remember to update those
primitives that are generated from code outside VMMaker.
MiscPrimitivePlugin for example.

I notice that Bitmap>encodeInt:in:at: for example uses both // and \\
so we'd need to make sure it works for translation and direct running.

At least we can soon drop SoundGenerationPlugin and it's complicated
fudging completely.

tim
--
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Oxymorons: Living dead



More information about the Squeak-dev mailing list