Friday, June 18, 2010

Re: numbering lines in groups

On Jun 18, 6:29 am, Bee <200...@calcentral.com> wrote:

> Please explain what you mean by the "tricky side effect semantics" as
> I am learning.

(Aren't we all?) In the expression

@l + setreg('l', @l<str2nr(@n) ? @l+1 : 0 )

the setting of the l register is a "side effect" of the evaluation of
the expression, but the value of the expression could depend on this
side effect. If the expression is evaluated strictly left to right,
the value of @l is taken and then changed, but if the setreg was done
first the answer would be different. The vim help says "All
expressions within one level are parsed from left to right" but I
could find no guarantee that it evaluates strictly left to right.
Many languages, not least C and C++, explicitly prohibit such
dependencies on the order of evaluation, though historically many
compilers ignored them.

Regards, John

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: