On Sep 23, Simon Cozens wrote:
> On Sun, Sep 23, 2001 at 03:52:13PM -0400, Mathieu Bouchard wrote:
> > Compiling Python and Ruby source-code to Parrot byte-code won't ever
> > generate any integer-specific, string-specific, or float-specific opcodes,
> > except to the extent required by the implementation of Python's and Ruby's
> > object systems in Parrot. (and also except if someone writes a really good
> > optimiser.)
> > Python's and Ruby's ideas of what are Integers, Floats and Strings would
> > have to be implemented directly in the Parrot assembly language to take
> > advantage of those bytecodes (and therefore of interoperability with
> > Perl).
> 
> You're right and you're wrong. Let me try and explain.
> 
> There are very few ways of adding two integers together. Well, to be honest,
> there are precisely two ways: you can add two integers together and get either
> the right answer or the wrong answer. Once a language acknowledges that it is
> dealing with pure, honest-to-God integers, then it is fairly easy to compile
> down to integer-specific opcodes.

    Of course, no (implementable) programming language *ever* deals with
actual integers.  They always deal with limited domains.  There are are also
language-specific issues dealing with definitions of extensions of functions
that are well-defined for, say, the natural numbers.  What is the _right_
way to evaluate each of the following?

            65535 + 2
            -6 % 5
            1 / 2
            1 / 3
            1 / 0

    - Kurt

Reply via email to