Re^2: Perl 5.11.0 now available
by JadeNB (Chaplain) on Oct 03, 2009 at 15:43 UTC
|
And maybe someone well-versed in technobabble should offer a footnote decoding highlighted terms:
Due to the commutativity breakage, code references are no longer treated specially when appearing on the left of the ~~ operator, but like any vulgar scalar.
It's hard not to suspect that you really do know what these mean, and are speaking up only as a voice for the downtrodden elsewhere; but anyway:
- Commutativity breakage
- Commutativity is the property of not depending on order (that is, the idea that things can be moved around without changing their identity—think of commuting to work). The classical instance of this is the fact that a + b = b + a for any numbers a and b; the referenced manifestation in Perl 5.10.0 was the fact that THING1 ~~ THING2 was guaranteed to work the same as THING2 ~~ THING1, whatever the things were. Since, for example, we now have
{ a => undef } ~~ sub { $_[0] eq 'a' }
(because the test succeeds for each key) but not
sub { $_[0] eq 'a' } ~~ { a => undef }
(since the stringification of the subroutine * is not a key of the hash), commutativity has broken. The general idea is that the right-hand side of the match now determines the semantics of the match; such a declaration automatically violates commutativity, since it depends on order prima facie.
- vulgar scalar
- This is a bit of humour. Previously, the thing on the left-hand side of
sub { $_[0] eq 'a' } ~~ { a => undef }
was treated differently from the thing on the left-hand side of
'b' ~~ { a => undef }
even though both are scalars—the former was treated as a “more special” scalar. In Perl 5.10.1 and subsequent releases, it loses this special status and is treated just as any other scalar would be. To call it therefore ‘vulgar’ may seem unnecessary, but it is exactly the classical linguistic sense of the word, and so one should probably not be surprised to see it from a linguist.
Whomever served up that sentence should be hung up by his meat and two veg until he sees the error of his ways.
I think that that answer permits me to point out that, quite aside from the strange content of your sentence, it's ‘Whoever’ you want, not ‘Whomever’.
* At least, I think that's how it works; I don't have an install on which to test. There's a note in the delta that undef no longer undergoes implicit stringification, so that
undef ~~ \%hash
is always false; I take that to mean, in a what-I-don't-not-say-isn't-not-true way, that other (vulgar) scalars do undergo implicit stringification. | [reply] [d/l] [select] |
Re^2: Perl 5.11.0 now available
by ikegami (Patriarch) on Oct 03, 2009 at 19:02 UTC
|
I'll submit a patch for s/where/when/ later todayMonday.
If "a ~~ b" were equivalent to "b ~~ a", smart matching would be commutative. It's not equivalent, so it's not commutative. As previously mentioned in the doc, smart matching was commutative in 5.10.0. It only mattered in edge cases, and it made overloading and other factors impossibly complex to handle and/or implement.
Vulgar means ordinary, plain, unspecial. In other words, a code ref on the LHS will be treated the same as any other scalar. It's actually redundant with the previous phrase.
| [reply] [d/l] [select] |
|
|
It's not equivalent, so it's not commutative.
Vulgar means ordinary, ... It's actually redundant.
In both cases, the problem is not with the strict interpretation of the descriptions, but rather with the inadequacy of the explanations as to their consequences.
Most every programmer, new or old, good or mediocre, understands that x-y is different to y-x, but perhaps only 5% or so would ever describe subtraction as non-communicative. And far less as "commutatively broken".
Beyond the value judgement that certain combinations of letters (words), are deemed vulgar in some circles, the only relatively common use of the word vulgar is "vulgar fractions". Also known as "common fractions". Which basically reduces to just "fractions".
Neither the sentence nor the overall understanding is enhanced by the use of "vulgar" in that position. It is technical or scientific language used to convey a false impression of meaningful technical or scientific content. Which is one (of the more polite), definitions of "technobabble".
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
|
|
Most every programmer, new or old, good or mediocre, understands that x-y is different to y-x, but perhaps only 5% or so would ever describe subtraction as non-communicative. And far less as "commutatively broken".
I sure hope not.
Noone said "commutatively broken" except you. You seem to think the doc say that smart matching is "commutatively broken", but it doesn't say that at all. It's commutativity that was broken, as documented again earlier in the document. Commutativity of the smart match operator was broken by 5.10.1.
the only relatively common use of the word vulgar is "vulgar fractions". Also known as "common fractions". Which basically reduces to just "fractions".
Same here. Just scalar.
| [reply] |
|
|
|
|
|
|
|
but perhaps only 5% or so would ever describe subtraction as non-communicative
Then one can only wonder what they make of the idea of left- or right-associativity in Operator Precedence and Associativity. (UPDATE: On re-reading, the substitution of ‘communicative’ for ‘commutative’ is quite funny.)
technical or scientific language used to convey a false impression of meaningful technical or scientific content
Or perhaps “unusual-to-domain language used to convey an impression of humour”, a special case of ‘joke’. (If ‘vulgar’ were some technical CS term, then your objection might be appropriate, but I think that's not the case.)
Anyway, much of this thread has been occupied with patches to documentation, and your where/when catch was a good one (it bugged me, too). If you find the language that offensive, and you've got better, then why not submit a patch?
| [reply] [d/l] [select] |
|
|
|
|
In other words, a code ref on the LHS will be treated the same as any other scalar. It's actually redundant with the previous phrase.
I don't think that it really is. UPDATE: Oops, but I'm wrong, because I misremembered the original sentence. The remainder of the post is now preserved only for posterity.
A commutativity breakage means that there are some circumstances in which the smart match depends on order, not that the smart match is always completely determined by the right-hand member. Indeed, for example, a smatch $scalar ~~ \%hash behaves differently when $scalar happens to be a hashref or arrayref from the way it behaves for coderefs. I think there's nothing about the phrase “commutativity breakage” to indicate this, so it needs to be made explicit in the following sentence (or elsewhere).
| [reply] [d/l] [select] |
|
|
I don't think that it really is.
Why not? How does "treated like any vulgar scalar" differ from "no longer treated specially"? (I said phrase, not sentence)
A commutativity breakage means that there are some circumstances in which the smart match depends on order, not that the smart match is always completely determined by the right-hand member.
I know. I never said otherwise.
| [reply] |
|
|
Re^2: Perl 5.11.0 now available
by ELISHEVA (Prior) on Oct 04, 2009 at 09:43 UTC
|
Though I find it amusing that you who often argue eloquently for the value of technical language are taking exception to the word "commutative", I completely agree with you that that is an awful sentence.
It is terribly overwritten, substituting rare and complex terms where simple speech would do nicely. Why not use the word "scalar" alone? Or if emphasis was desired, why not use ordinary scalar or even plain old scalar rather than the obscure word "vulgar"? Why turn the relatively clear clause ~~ is no longer commutative into a convoluted noun phrase commutivity breakage? Due to the fact that ~~ is no longer commutative... is far more specific about what has changed and avoids the awkward noun phrase entirely.
Perhaps all this seems to some like stylistic quibbling. However, programming language documentation is hard enough to read even when it is clearly and simply written. In the Perl community we are fortunate to have a fairly large number of people with right brained tendencies and strong verbal skills, more perhaps than other programming communities. Taking advantage of their insights to improve documentation can only be good for Perl.
Best, beth
| [reply] |
|
|
| [reply] |
|
|
The introduction tells all! Whispers of an "evil power" ... literature!? And its not by Tolkien!? We get it, you're well read ... wait a minute, is that book the new pumpkin?
| [reply] |