On Nov 29, 2007, at 9:17 PM, Will Coleda (via RT) wrote:

# New Ticket Created by  Will Coleda
# Please include the string:  [perl #47972]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=47972 >


 From DEPRECATED.pod:

The C<getclass> opcode is deprecated (replaced by the C<get_class>
opcode) and
will be removed after the 0.5.0 release.


So, I have sandbox where I've started the process of removing getclass, and I've come across a snag (reminiscent of my desire to use parrot io's slurp, but also avoid 'getclass').

.sub main
  say 'what'
.end

is translated into the following bytecode:

     0 getclass P0, "ParrotIO"          P0=PMCNULL
3 set_args PC1 (2), P0, "what" PC1=FixedIntegerArray=PMC (0x8210e18) P0=Class=ParrotIO:PMC(0x81db440)
     7 get_results PC6
9 callmethodcc P0, "say" P0=Class=ParrotIO:PMC (0x81db440)
what
    12 set_returns PC6
    14 returncc

So, it's equivalent to:

.sub main
 $P0 = getclass 'ParrotIO'
 $P0.'say'('what')
.end

... But there's doesn't seem to be a way to do this without:

1) using getclass (aka, reject this ticket)
2) doing something custom for the say method here (like, say, translating say 'what' into something like "getstdout P0; P0.'say'('what');" 3) eliminating the automagic method translation used here and just writing a 'say' opcode.
4) find a syntax that works generically like the current method does;

There are currently 42 of these automagic translations (found in src/ builtins.c)

What's the desired approach here? I'd prefer 4 slightly over 3; neither requires a deprecation cycle (unless as part of 3 we decide to not support opcodes/faux-opcodes for some of them.); 2 is evil. I am neutral on 1.

--
Will "Coke" Coleda
[EMAIL PROTECTED]


Reply via email to