On 8/4/05, Luke Palmer <[EMAIL PROTECTED]> wrote:
> How can that possibly work?  If a bare closure { } is equivalent to ->
> ?$_ is rw { }, then the normal:
> 
>     if foo() {...}
> 
> Turns into:
> 
>     if foo() -> ?$_ is rw { }
> 
> And every if topicalizes! I'm sure we don't want that.
> 
> Luke


Here's one solution:

1) Bare blocks don't topicalise if you call them without an argument.

2) 'if' doesn't pass the value of the condition to its body, _UNLESS_
the body is incapable of accepting 0 arguments.


This means:

* The most common case, "if foo() { ... }", won't topicalise.

* If you /really/ want to access the value of the conditional, you can
say one of:
    if foo() -> $_ { ... }    # topicalise
    if foo() -> $cond { ... } # don't topicalise
and 'if' will give it to you.

* The bare-block-to-pointy-sub rewrite rule is preserved, because a
bare block's parameter is optional.

Is there anything I've failed to take into account?


Stuart

Reply via email to