Re: lazy-let & loop

Bruno Haible <[email protected]> Sun, 31 Dec 2017 17:23:15 +0100
Newsgroups gmane.lisp.clisp.devel
Message-ID <1672974.0aLLtynQ5B@omega>
Sam wrote:
> >> The problem with loop is that under certain circumstances we separate
> >> initializing and binding of a variable.
> >
> > This is not a problem by itself. It is explicitly allowed by CLHS
> > 6.1.1.4 "Implementations can interleave the setting of initial values
> > with the bindings."
> 
> If I understand you correctly, this merely implies that the naive user
> expectations are not guaranteed. Sure. Why not give them what they want
> if we can though?

The ANSI CL standard is explicitly vague in this area, so that implementations
can optimize loops well.

Look how GCC handles such a situation: Recently you encountered code which
  - was not portable across C implementations,
  - did things that the original author _thought_ would be OK but it was in
    fact risky code.
GCC showed a warning "multiple unsequenced modifications". Then we modified
the code to avoid the area of pitfalls.

The same approach is good here as well. I've added a warning
  Reference to <symbol> is implementation-dependent, per ANSI CL 6.1.1.4.
This has two benefits:
  * Users have an opportunity to change their code in such a way that it is
    guaranteed to be ANSI CL compliant (and therefore portable to ANSI CL
    implementation).
  * We don't need to modify clisp to improve such uses of LOOP, when it
    would be detrimental to the performance of other uses of LOOP (that don't
    generate a warning).

Bruno


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel