[Python-Dev] Parrot -- should life imitate satire?
Thomas Wouters
thomas@xs4all.net
Tue, 31 Jul 2001 22:32:59 +0200
On Tue, Jul 31, 2001 at 11:10:50PM +0300, Moshe Zadka wrote:
> On Tue, 31 Jul 2001, Guido van Rossum <guido@zope.com> wrote:
> > Actually, this may not be as big a deal as I thought before. The PVM
> > doesn't have a lot of knowledge about types built into its instruction
> > set. It knows a bit about classes, lists, dicts, but not e.g. about
> > ints and strings. The opcodes are mostly very abstract: BINARY_ADD etc.
> PUSH "1"
> PUSH "2"
> BINARY_ADD
> In Python that gives "12". In Perl that gives 3.
> Unless you suggest a PERL_BINARY_ADD and a PYTHON_BINARY_ADD, I
> don't see how you can around these things.
The Perl version of the compiled code could of course be
PUSH "1"
COERCE_INT
PUSH "2"
COERCE_INT
BINARY_ADD
for Perl's
"1" + "2"
and
PUSH "1"
PUSH "2"
BINARY_ADD
for it's
"1" . "2"
(or, in the case of variables instead of literals, an explicit
'COERCE_STRING' or whatever.)
--
Thomas Wouters <thomas@xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!