Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^7: Perl is dying (better sorting than the ST)

by demerphq (Chancellor)
on Feb 11, 2007 at 11:22 UTC ( [id://599444]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Perl is dying (better sorting than the ST)
in thread Perl is dying

If perl knew the array was going to be thrown away at the end of the statement, and that all indexed look ups were within the bounds of the original.

Its a big if, hence the reason I mentioned Python's tuples, which could be seen from a perl perspective to be a form of compiler hinting, telling the compiler that an AV need not be constructed. You could prototype the syntax using a RO AV for instance.

---
$world=~s/war/peace/g

  • Comment on Re^7: Perl is dying (better sorting than the ST)

Replies are listed 'Best First'.
Re^8: Perl is dying (better sorting than the ST)
by diotalevi (Canon) on Feb 11, 2007 at 20:49 UTC

    I'd make you say map tuple( ... ) and then you'd get your promised thing which I guess is smaller and has no mutators.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      Yeah. The idea is that a tuple is immutable; once it’s been constructed, it can no longer be modified. In that case, perl does know the extent of the data structure: it’s the extent of the data structure at the time of its construction.

      It would have more applications than just map, too. The idea’s not bad. (Of course it doesn’t redeem the ST in my opinion…)

      Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://599444]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-26 01:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found