cardinal-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Cardinal-dev] RubyInRuby parser/compiler


From: Anders Bengtsson
Subject: Re: [Cardinal-dev] RubyInRuby parser/compiler
Date: 01 Jan 2003 22:46:15 +0100

David Robins wrote:
> > For example, the following ruby code
> > a=1+2
> >
> > Will have to be quite long.  What we have to do here is
> 
> > * Create a object of type "Fixnum"
> > * Set that object to the value 1
> > * Create another object of type "Fixnum"
> > * Set that object to the value 2
> > * lookup the subrutine "+" in the first object (or maybe it's enough to
> > look that up in the class "Fixnum")
>
> Well, actually I don't think it's that bad, since if we invoke the Parrot
> "add" operation, then it can call the PMC's add function and provide various
> shortcuts, perhaps not having to do a method lookup if the lhs is, say, a
> RubyFixnum or a RubyInteger.  Only the RubyObject PMC need invoke a '+'
> method.

Hi all,

I think it may be hard to avoid doing at least a partial method lookup.
The method '+' can't be overridden on the individual object level for
Fixnums, so the lookup can be done directly at the class level, as Erik
says. But at the class level the method can be changed at any time, so
some kind of lookup has do be done.

What are the plans for Fixnum in Cardinal, will it first be done as
plain non-optimized objects, or is there already work being done on a
"native" integer implementation?

/Anders

-- 

A n d e r s  B e n g t s s o n  |  address@hidden
Stockholm, Sweden               |

_____________________________________________________
Gratis e-mail resten av livet på www.yahoo.se/mail
Busenkelt!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]