develooper Front page | perl.perl6.internals | Postings from October 2002

RE: C# and Parrot

Thread Previous | Thread Next
Brent Dax
October 18, 2002 00:55
RE: C# and Parrot
Message ID:
Rhys Weatherley:
# I'm Rhys Weatherley, the author of Portable.NET, which is 
# part of the DotGNU project.  (Put down that flame thrower!  I 
# come in peace. :-) )

Hey.  Don't worry--we're not worried about DotGNU.  On the other hand,
if you said you were on the actual .Net development group, it would
probably be toastin' time.  :^)

# I'm a bit confused as to how one creates a user-defined class 
# in Parrot, and makes virtual method calls, accesses fields, 
# and what-not.  I can't seem to find a good example (Cola does 
# non-virtual methods only at present).

You don't, at least not yet.  Eventually, there'll be an Object PMC
(which can be inherited from to make PerlObject, CsObject, etc.); to
retrieve a method, you'd probably call something like
getmethod(methname) on the Object, then push your arguments onto the
stack and call invoke() on the Sub (PerlSub, CsMethod (no subs,
right?)...) PMC getmethod() gave you.  For a multimethod subroutine, the
Sub PMC would look at the types of the arguments on the stack and choose
which routine to invoke; for a normal subroutine, it would just invoke
the code.  Presumably, the C# compiler could optimize that further.

Oh, by the way, that's all speculation until Dan Sugalski specs it out.

# Is there a convention for which registers must be saved
# across a call and which can be clobbered?  Using the 
# saveall/restoreall convention and passing all values on the 
# stack doesn't seem terribly efficient.  But maybe I'm missing 
# something?  Is the JIT smart enough to optimize away 
# unnecessary copies?

There's a PDD on that, but IIRC it's out of date.

# What is the size of the "int" type?  Will it always be 32 bit 
# or is it "whatever is best for the machine"?  And how do I 

It's always at least 32 bits, but is selectable at Configure-time.  Most
systems it'll be 32, but on a few it'll be 64.

# Is there some means to store and access auxillary data in
# a Parrot bytecode file?  I might need this to store metadata 
# for supporting C# reflection.

You would probably attach this to the CsObject and CsMethod PMCs.

# We in DotGNU should be able to bang out C#->Parrot fairly 
# quickly, if we can resolve the above issues.

Please remember that Parrot is very much a work in progress.  We've done
a lot in the one year, one month and one week (really!) since we
released, but we still have a lot to do before it's really usable for
full languages.

--Brent Dax <>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)

Wire telegraph is a kind of a very, very long cat. You pull his tail in
New York and his head is meowing in Los Angeles. And radio operates
exactly the same way. The only difference is that there is no cat.
    --Albert Einstein (explaining radio)

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About