Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Re: Re: Re: LVALUE refs

by Elian (Parson)
on Feb 14, 2003 at 18:31 UTC ( [id://235359]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: LVALUE refs
in thread LVALUE refs

I'm hoping that the powers that be will allow this syntax once references to @str will always start with @ in perl 6. Then $str3 and @str3 will be clearly distinct things and then $str3..7 could be the equivalent of substr($str, 3, 5) which I think would be much more usable as I often know the start and end positions and have to perform (unintuative) math to translate this into a start/length pair. I quite like the idea of $str3,5,6,7 = $str5,3,7,6; as a similar concept to an array slice operation on a string, but I can see problems with it.
Probably not. I don't think slices will get quite that much support, and it's distinctly possible that it'll be considered acceptable for slices to be done programmatically via iteration, rather than in a single delegated call to the variables. (Yeah, I know that it'd be cool to get your tie code handed the entire slice, but it's a lot of work and makes some other things more difficult)

There'll be other tricks you can do that, while they don't solve this problem, can make other things nifty. Specifically for $foo[1][2][3][4]{z}, $foo will, if its tied, get handed the entire subscript list, and can do whatever it wants with them. In the common case it'll take the leftmost one and pass the rest on, but it doesn't have to--if $foo was a 4D array it could snag the first four and pass the rest, in this case the hash subscript, on to whatever it fetches.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-24 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found