Klaas-Jan Stol wrote:
> On Sat, Aug 30, 2008 at 11:04 AM, Allison Randal <allison@perl.org> wrote:
>>>
>> Yes, it will be deprecated, or at least renamed. The C<.return> directive
>> without parentheses is an old convention for passing a single return result,
>> and must always be sandwiched between C<.begin_return> and C<.end_return>.
>
> Do you mean this one? (see next)
>
> .begin_return
> .return "hi"
> .return 42
> .return 3.14
> .end_return
>
> (which is the same as: .return ("hi", 42, 3.14) )
> Is the purpose of renaming this to make a clear distinction between the
> '.return' directive in this long style of returning and the short one
> ('.return ()' ) ?
Yes. That whole set of directives would benefit from clearer naming.
Perhaps:
.set_return "hi" # return value passed, between .begin_return
# and .end_return
.set_arg "foo" # argument passed, between .begin_call and .end_call
.get_result # result retrieved, between .call and .end_call
>> And, there's another C<.return> without parentheses that performs a
>> tail-call, invoking a sub or method reusing the same return continuation.
>> This should also be renamed.
>
> Is the purpose to be more explicit on being a tailcall? (in that case, it
> could be renamed as ".tailcall" or whatever -- but that's obvious)
Obvious is good.
>> The only directive that should be named C<.return> is the one that returns
>> a value or values (i.e. it's syntactic sugar for a whole collection of
>> low-level directives/opcodes).
>
> and this would be: .return ("hi", 42, 3.14)
> right?
Yes.
Allison
Thread Previous
|
Thread Next