|Do you know where your variables are?|
RE: RE: Postfix, whole-object dereference operatorsby tye (Sage)
|on Jul 21, 2000 at 19:53 UTC||Need Help??|
As another noted, the worst case isn't when you have something simple like $foo. Plus, I didn't mention the other postfix dereference operators flavors:
I particularly hate the wide separation of the @ and the [3,7] above.
But you don't have to use it. I agree that taking a reference should be prefix and never proposed (nor saw a proposal for $foo->\. But most of the dereferencing I do is already postfix via -> anyway.
If you don't like it, you must be typing:
instead of either of:
The added postfix dereference operators just round things out so I can use postfix for more than just getting a single element. Note the nice similarity:
I really doubt I'd write $foo->@, reserving its use for chains of dereferences like above.
Now, the really whacky thing I'd love to see is the list dereference operator, but that patch is just too much work for the size of audience who can appreciate it. It lets you take multi-dimensional slices:
I had a real use for this when I was automating installations of WindowsNT. To make complex decisions about how to partition and format hard disks, I built a big data structure that described tons of details about the current configuration of your hard disks and partitions. This in itself was very handy but I kept wanting to do things like:
It feels a lot like map.
OK, enough rambling.