I don't thin that this is classified as a closure
All Perl subroutines that use lexical variables are closures.
A warning would be good, though.
| [reply] |
undefined behavior is a Bad Thing(TM)...
This is why I think that is a bug!
The term "bug" is usually reserved for certain
specific types of Bad Things, though. C requires
the programmer to micromanage memory, which is
absolutely without question a Very Bad Thing, but
nobody considers it a bug, because C was designed
that way. (When C was designed, most languages
were that way, because computer memory was a more
valuable resource than programmer time. The notable
exception to this is Lisp, which already had the
garbage collection we're going to be getting in
Perl6, but Lisp was way ahead of its time.)
And I don't think that this is classified as a closure
No, I didn't mean to imply that it was. I was using
closures as another example of a case where Perl is
doing what it was designed to do, but not everyone
understands it immediately and it's certainly not
a bug.
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
| [reply] [d/l] |