From: Dan Sugalski Date: 2002-01-02T05:07:42+09:00 Subject: [ruby-talk:29984] Re: Parrot (was re, Python and Ruby: a comparison) At 09:21 PM 1/1/2002 +0900, Erik B�gfors wrote: >On Mon, 2001-12-31 at 18:18, Dan Sugalski wrote: > > At 02:02 AM 1/1/2002 +0900, Michael Kelly wrote: > > >On Mon, 31 Dec 2001 12:26:46 +1100, Michael Lucas-Smith >Check out > > >Parrot > > > >(http://www.panix.com/~ziggy/parrot.html) > > > >(http://archive.develooper.com/perl6-internals@perl.org/msg06916.html) > > > > > > > >It's trying to do exactly that. A common VM underneith Python, Perl6 and > > > >Ruby. > > > > > > > > > >Interesting Michael. I'll take a look right now, thanks. > > > > As the Parrot designer, I'd be happy to answer any questions anyone might > > have either on or off list. (As folks deem appropriate--I don't want to > > waste folk's time inappropriately) > >I've looked through the "how to program in parrot assembler" or whatever >those documents were called and I have just a few questions. > >* Is there anyone working on ruby-support? Someone's occasionally poking at it, but that's about it. I'd like there to be more than just poking. >* There are registers for integers, floats, strings and something that >from what I understod could be "objects". Since everything in ruby are >objects wouldn't that mean that ruby would only use that register type? >What would happen is I from ruby used a perl-class that retured a >integer and ruby doesn't do integers? Overall I don't quite understand >how the whole language independence is supposted to work. The integer, string, and float registers are generally for internal use. Shortcut scratchpad things and such, generally not for passing around. The inter-language calling convention isn't in stone quite yet, but generally you pass PMCs around. It's the responsibility of the caller and compiler to make sure that what's sent is compatible with what's wanted. (So if a routine was marked as taking an integer and you passed a PMC, either a conversion would be done or an error thrown) >* I assume there is also a stack on not only registers? I've never read >anything about that though. (how would you store more than 32 objects >otherwise for example) There's a general-purpose stack. Each register set has an associated stack for full-frame push and pops. There's a global hierarchic namespace for global things to go into, and scope-tied scratchpads for lexical variables. Support for the global and lexical spaces is waiting on some hash stuff--as soon as that's committed we'll have support. (I think there's documentation for it) >* How is garbage collection done? This is different between ruby and >python for example. Will one language have to learn the other way?? When an object is no longer referenced, the dead object detection phase notices at some point and cleans it up. There's no guarantee of when, but if a language wants stricter guarantees it can force a dead object detect run. I thought Ruby and Python both had a "no guarantees when" GC, though. (Guido's told me that's what Python does, and I assumed Ruby did the same, but I could well be wrong) And language specific GC behaviour only holds within code generated by that language's compiler. Pass a Ruby object to Perl/Python code and most bets are off for determinism. >* How will blocks be used from other languages that doesn't do blocks?? You're talking semi-standalone chunks of code that can be executed as a sort of anonymous subroutine or method, right? Perl and Python both have those. If a language doesn't have 'em, then it can't call into a function that requires one. Not much to be done about that. (Though I don't see it as a problem--the inter-language calling conventions define how you call from one language to another, they don't require any language to actually implement everything the convention allows) >BTW, it's VERY nice to see a parrot designer here on the ruby-list :) I'm taking notes and trying to stay out of the way for now. :) Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai dan@sidhe.org have teddy bears and even teddy bears get drunk