develooper Front page | perl.perl5.porters | Postings from July 2009

Re: [PATCH] Remove implicit split to @_

Thread Previous | Thread Next
Michael G Schwern
July 9, 2009 14:02
Re: [PATCH] Remove implicit split to @_
Message ID:
Michael G Schwern wrote:
> I'm willing to guess there's lots of code inside split() which can now be
> removed.  Like that following line checking to see if ary exists outside list
> context, which now cannot happen.  But the code for split() is terrifying so
> I'm going to do the minimal work.
> A warning about use of split in void context should probably also be added.
> That now does nothing but regex side effects and that's just a silly use of
> split().  Again, I don't have the necessary core hacking bits to do that.

I've reorganized my git repo and pushed this up to github as a topic branch
for easier pulling and others working on the optional bits above.

Yitzchak said:
> Useful?  Doesn't seem so to me.

I replied to Yitzchak off list, because I thought he was joking and it was
late and I'd had a few beers and I'd been joking that someone on p5p would
manage to find fault with this change.  He was alluding to the mess
surrounding sort in scalar context never being resolved.

(Sorry to sock puppet you here, Yitzchak.  Please chime in.)

Yitzchak said:
> I don't get why you'd want to do that.  If I wanted to count
> space-separated fields, I'd do:
> $count = 1 + $thing =~ y/ //;

Yitzchak's altnerative approach is very clever but underscores the need for
making split in scalar context just DWIM.  Because... damn, that's how you're
supposed to count fields?

...they shared one last kiss that left a bitter yet sweet taste in her
mouth--kind of like throwing up after eating a junior mint.
    -- Dishonorable Mention, 2005 Bulwer-Lytton Fiction Contest
           by Tami Farmer

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About