Front page | perl.perl6.language |
Postings from April 2002
Re: Exegesis 4
Thread Previous
|
Thread Next
From:
Piers Cawley
Date:
April 3, 2002 21:21
Subject:
Re: Exegesis 4
Message ID:
m2adskujtq.fsf@bofh.org.uk
Damian Conway <damian@conway.org> writes:
> Larry explained:
>
>> : Umm..... didn't you say bare blocks were going away?
>>
>> Rule #2 was invoked.
>>
>> The current thinking is that any bare block will never be interpreted
>> as returning a closure. You have to use explicit C<return {}> or C<sub {}>
>> to return a closure.
>
> Or the equivalent of a C<sub {}>, namely:
>
> $closure = -> {...};
>
> or:
>
> $closure = { $^has_a_placeholder_variable };
>
>
> Or an explicit closure context:
>
> sub foo(&closure) {...};
>
> foo { this_block_is_a_closure() };
The closure is going to close over all the variables currently in
scope isn't it? Not just the immediately containing scope.
--
Piers
"It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
-- Jane Austen?
Thread Previous
|
Thread Next