Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^8: Evaluation Order again. (pedantry)

by tye (Sage)
on Jun 02, 2016 at 06:36 UTC ( [id://1164732]=note: print w/replies, xml ) Need Help??


in reply to Re^7: Evaluation Order again.
in thread Evaluation Order again.

I must concur that this argument about your pedantic definition of the word "argument" is neither helpful nor enlightening.

On my first try, I found:

A value or reference passed to a function, procedure, subroutine, command or program, by the caller. For example, in the function definition

square(x) = x * x

x is the formal argument or "parameter", and in the call

y = square(3+4)

3+4 is the actual argument.

Clearly, "3+4" is not a value, it is an expression.

Yes, in the case of Perl 5, things get a little more muddled and one way to conceptualize things in an attempt to unmuddle them is to declare that the invocation of a Perl sub does not take a list of "actual arguments", but instead, a single expression that might result in multiple values and thus the presence of a comma is not really separating (actual) argument (expression)s.

But talking about Perl sub arguments in the standard manner doesn't run into problems in the majority of cases. And even when it does, there are other ways to unmuddle things that don't require throwing out the familiar model and language just because it doesn't quite fit for some cases.

So stop insisting people are wrong just because they choose to use one word in a traditional and widely-understood manner.

I actually believe that Perl's comma operator is just a descendant of the use of comma to separate actual argument (expression)s in function calls. And the list-flattening behavior really isn't enough reason to insist that everybody abandon that way of understanding them and talking about them.

Shell scripts have an analogous situation but my copy of "man bash" deals with that without your pedantic gymnastics:

Unquoted implicit null arguments, resulting from the expansion of parameters that have no values, are removed.

and

yank-nth-arg (M-C-y)
Insert the first argument to the previous command (usually the second word on the previous line) at point.

You see, they don't feel ashamed to occasionally talk about an expression as an "argument" even though, based on their definition, it strictly (pedantically) isn't:

The words that are not variable assignments or redirections are expanded. If any words remain after expansion, the first word is taken to be the name of the command and the remaining words are the arguments.

- tye        

Replies are listed 'Best First'.
Re^9: Evaluation Order again. (pedantry)
by ikegami (Patriarch) on Jun 02, 2016 at 15:19 UTC

    Writing clear documentation is an exercise in pedantry. If someone is argue that the documentation should be changed, I consider the choice of words in the proposed revision to be very important. In this case, it could easily be fixed by replacing "the arguments" with "the argument list". I don't why there's no much resistance to this. It's silly that so much fuss is being made about this since the point I was making is that proposed statement is still wrong when you fix the wording.

    If you argue that "3+4" is the actual argument in "f(3+4)", then you get in the ridiculous situation where you say that "@a" is the actual argument in "f(@a)".

      Writing clear documentation is an exercise in pedantry.

      Uh, no. So very much, no. Pedantry is too far along the spectrum to the point that it actual interferes with communication and reduces clarity. Clear documentation is usually helped by some precision in verbiage. Becoming pedantic leads to wasting time splitting hairs, making the documentation harder to follow.

      It's silly that so much fuss is being made about this since the point I was making is that proposed statement is still wrong when you fix the wording.

      Unfortunately, you are so committed to this particular pedantry that you believe this, but I went over what you wrote several times trying to find the non-pedantic point being obscured by your zeal for proper use of one word and I'm pretty sure it isn't there, else I'd not have responded as I did.

      For example, your sub { }->( X1() = X2() || X3() ); response doesn't demonstrate a flaw in the proposed explanation. It is again just laser focused on how "argument" is the wrong word. When (mildly) misusing "argument" (by using the common definition when talking about Perl), the order of evaluation of "arguments" does not apply in sub { }->( X1() = X2() || X3() ); because there is only one 'actual' argument (expression) in that call. Yes, of course, it isn't hard to realize that more than 1 or even 0 values might result as the list of argument values actually passed to the subroutine. It isn't hard to realize so being pedantic about the word choice more hurts than helps understanding.

      You aren't demonstrating the incorrectness of the concepts behind the statement. You are still picking the wrong concept to use in your interpretation of the statement simply because the word "argument" was used. You are demonstrating that your pedantry has prevented you from understanding the intended statement.

      If you were less pedantic about it, you might have succeeded in communicating (or perhaps even understanding yourself?) that making a statement about evaluation order of (actual) "arguments" should really be a statement about "lists (of expressions separated by commas)" or (less clearly but more precisely) about "the comma operator". But such a statement can be made clearer by bowing to the reality that the comma operator is still strongly conceptually tied to its origin as a way to separate subroutine arguments. So make a statement about lists and/or commas but add something like "including the list of expressions used as the arguments for a call to a subroutine".

      I got that point by reading what your wrote... eventually. But, boy, was it a struggle to pierce the pedantry to be able to get that point.

      The fact that order of evaluation applies to the list of actual argument expressions in a subroutine invocation is an important one. And it is helpful to explicitly point that out, and not to just imply it by noting that "these aren't subroutine arguments, they are just uses of the same comma operator". As you point it out, you can also point out the sameness, but even doing that pedantically makes it harder to understand.

      - tye        

        Uh, no. So very much, no. Pedantry is too far along the spectrum to the point that it actual interferes with communication and reduces clarity. Clear documentation is usually helped by some precision in verbiage. Becoming pedantic leads to wasting time splitting hairs, making the documentation harder to follow.

        Maybe I misunderstand the term? I mean I pay excessive attention to the clarity of the text.

        Sorry, but I don't think it's fine to say that f(@a, @b) has two arguments. I think this is more than just just a mild misuse.

        The argument list expression is not exceptional. It's evaluated according to the same rules as any other expressions.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-25 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found