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

Andreas Raab andreas.raab at gmx.de
Wed Apr 7 19:31:25 UTC 2004


Dan,

> >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 \\.

There is a reason to use new names that I think is even more important than
my personal preferences ;-) It allows someone to *change* the meaning of
division in either way if there is a need to.

First of all, I don't know if there are any machines/compilers out there
which round differently. I just don't know.

But let's assume we find one at some point. What's going to happen? The
first thing that *should* happen is that you get an error when you try to
compile the VM (this is why I want those assertions for) - it makes clear
that this is an area you need to look into and *carefully* so.

Now, in many cases we'll just be able to compile the VM nevertheless. Fine.
So it works. Up to a point where it no longer works and you need to look
into the nasty details. Something is going wrong, possibly because of the
division but how are you going to find out even if you have the simulator?
Changing all of the #quo: and #rem: messages to #// and #\\ and forth and
back?

That's what I want div: and mod: for - in this case you'd go into those
methods and change them to figure out where the problem is and if you found
it you can try to fix it so that it works "both ways". Or at least you might
have an easy way to describe the problem and ask for help, say: "I have
found that on my machine I get this rounding error when I try to compile the
VM. I've managed to compile it nevertheless but WarpBlt screws up when I
rotate a rectangle. You can actually see that if you change div: and quo: to
use // and \\ - any ideas how to fix that?" etc.

Cheers,
  - Andreas




More information about the Squeak-dev mailing list