I
I
icon2012-11-28 00:22:31
Perl
icon, 2012-11-28 00:22:31

Tight binding, Russian equivalent?

In the Perl literature, the phrase "xxx binds tightly" is used to refer to an operator that acts on a neighboring operand without parsing the context, due to which, for example, the construction is erroneous

open FILE, "$file" ||  die "Can't open: $! \n";

instead it is recommended to use
open FILE, "$file" or die "Can't open: $! \n";

because the "or" operator binds less tightly than ||
or enclose the arguments of the open function in parentheses, like this:
open(FILE, "$file") || die "Can't open: $! \n";

Question: what Russian phrases (possibly jargon) describe this property of operators?
After all, in this case it is incorrect to say that the priority of the operator || greater than the precedence () (of a function call), because it depends entirely on the presence or absence of parentheses in the function call description.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MikhailEdoshin, 2012-11-28
@icon

No, this just describes the precedence of operators. And using orinstead ||helps not because y has ora lower priority than y ||(although it does), but because it is lower than a comma ( ,), while y ||is higher than a comma.
Parentheses are not syntactically related to operators; The parser that works with the operator precedence table, in fact, just places the brackets in the expression. And in this case, as I understand it, these are not brackets, but really a function call (I don’t know Perl, unfortunately). But in any case, the brackets in the given turn the left expression into an indivisible atom, and the parser will no longer pull it out "$file"and attribute it to ||. By the way, is there another option?

(open FILE, "$file") || die "Can't open: $! \n";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question