in reply to Re (tilly) 9: Hash slices ?
in thread Hash slices ?
I am loath to even reply, so I'll try to keep it short.
There is no .. in the examples we have been discussing. I see a few elipses that look like Perl's ... operator but that clearly aren't meant as range nor flip-flop operators in that setting.
One of the examples has elipses while the other two don't. Are we supposed to draw some deep conclusion about the reasoning behind that? Two of the examples are short and one is long. I have an "absurd theory" that the long example has an elipsis and is missing the "same as" for the same reason: because it is long and forcing a line wrap would reduce the readability.
I did a quick search to see if I could turn up previous discussions about the fact that many details of Perl's behavior are intentionally not documented. The basic idea is that some behaviors aren't particularly important and it is good to leave things open in case later optimizations or enhancements change these "edge" behaviors (intentionally or accidentally). Unfortunately, old Usenet isn't well archived (or at least indexed and available to me) at the moment.
The behavior of an array slice in a scalar context seems a quite reasonable example of such to me. Reading the code, I get the impression that the current behavior is more an afterthought during implementation than a careful design decision. (Not to mention the fact that it isn't documented anywhere [*cackle*].)
But anyway, the interesting bit about the search was that it turned up this:
NETaa13671: array slice misbehaved in a scalar contextwhich I got a good chuckle out of. Apparently, long ago, I actually patched Perl to fix "array slices in a scalar context" (I haven't yet been able to summon a memory of this). Anyway, I thought that was pretty funny. (:
From: Tye McQueen
Files patched: pp.c
A spurious else prevented the scalar-context-handling code from running.
So it is possible that array slices in a scalar context didn't even "work" before I came along.
Looking at a modern Perl (5.6.0) I see no tests for the behavior of an array slice in a scalar context (more evidence, to my mind, that this is considered an "edge" case).
But none of this matters much. You have been completely unswayed by all of my erudite elocutions while I find your "absurd" and elaborate theories about how to claim that this simple behavior is (magically, implicitly) "documented" increasingly comical. q-: (You may have to read that with a good, pompous tone of voice to get the silliness of it.)
That is to say, we aren't getting anywhere so let's just stop! I know I'm quite tired of it and I suspect that most (if there are any) of those that have read this far are getting tired of it as well.
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 11: Hash slices ?
by tilly (Archbishop) on Apr 16, 2001 at 03:57 UTC | |
by tye (Sage) on Apr 16, 2001 at 10:46 UTC | |
by tilly (Archbishop) on Apr 16, 2001 at 16:12 UTC |