:: Re: [DNG] Evince
Top Page
Delete this message
Reply to this message
Author: Hendrik Boom
Date:  
To: dng
New-Topics: [DNG] elisp &c (was: Evince)
Subject: Re: [DNG] Evince
On Tue, May 24, 2016 at 02:47:04PM +0100, Rainer Weikusat wrote:
> Didier Kryn <kryn@???> writes:
> > Le 23/05/2016 23:29, Rainer Weikusat a écrit :
> >> Rainer Weikusat <rweikusat@???> writes:
> >>
> >> [...]
> >>
> >>> Emacs is a somewhat old-fashioned/ traditional[*] Lisp implemenation
> >> [*] It doesn't support lexical scoping.
> >>
> >
> >     No idea what that means.

>
> It means that any binding of some symbol is globally visible during the
> dynamic lifetime of the scope which established it instead of being
> restricted to code which is lexically contained in this scope.
>
> Contrived example for that:
>
> ; function returning the current value of x + 1
> ;
> (defun 1+x () (1+ x))
> -> 1+x
>
> ; function which binds x to the value passed as argument and
> ; then invokes 1+x
> ;
> (defun 1+v (v)
>   (let
>       ((x v))
>     (1+x)))
> -> 1+v

>
> ; set x to 15
> ;
> (setq x 15)
> -> 15
>
> ; call 1+v with argument 4
> ;
> (1+v 4)
> -> 5
>
> ; call 1+x in the global environment
> ;
> (1+x)
> -> 16
>
> This can be executed via *scratch* buffer which does Lisp evaluation
> upon C-j. I've marked the lines showing return vaues with ->.


Note: This example describes dynamic scoping. The call to (1+x) uses
the x that's active where it is called, not where it is defined.
In lexical scoping, it would always use the x where it is defined, no
matter what extraneous x's are around where it is called.

>
> 'Lexical scoping' (which works the way 'local variables' usually work in
> other languages) didn't exist in the 'Lisp world' until Scheme came to
> be.


Not quite. In Lisp 1.5 way back in the 60's they realised absence of
lexical scope was a problem, and invented a wrapper called FUNCTION that
you placed around a lambda expression that would make the enclosed lamda
expression lexically scoped. But Scheme decided that the extra syntax
was stupid and implemented lambda expressions lexically from the start.

-- hendrik