[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Perl Moral Support



Ariel Scolnicov wrote:
> John Porter <jdporter@min.net> writes:
> 
> > Ariel Scolnicov wrote:
> > > 
> > > Both languages let you have functions as (nearly)
> > > first-class objects 
> > 
> > Perl closures can be perl objects (no "nearly" about it):
> 
> That's not quite what I meant. ...
> The term "first-class object" itself has little to do with...

Oh, yes, right; I missed the "first-class" part.  :-)


> If I take say "bless $ref, 'Foo'" then 
> I get a Foo object, no matter what $ref was originally referring to

s/was originally referring/refers/.


> The main reason I
> wouldn't call function references "first-class objects" is that the
> language itself sometimes bypasses the function object mechanism
> (e.g. "sort { $a <=> $b } @list").

I don't see how this bypasses anything.
{...}, in certain contexts, is defined as being equivalent to sub{...}.
AFAICT, sub refs are first-class objects in Perl.


-- 
John Porter

Since time is short, and you may lie, I'm going to have to torture you.


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe