[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reference variable before definition

From: Eric Abrahamsen
Subject: Re: reference variable before definition
Date: Sat, 11 Mar 2017 19:40:35 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> Has it always been this way, and it only just got through to me? I
>> didn't think it was necessary to define everything before use in a
>> function...
> I think it's been that way for a while, yes.  It used not to be terribly
> important, indeed, but since Emacs-24 it became a lot more important,
> because the byte-compiler compiles variables differently if they've been
> declared via `defvar`.  And it doesn't first scan the buffer for
> defvars, so by the time it sees the defvar it has already (mis)compiled
> the earlier uses of that variable.

Okay. Apparently this also applies to defclasses and slot access -- the
classes need to be defined before any function calls slot-value. I'm
surprised I never ran into this before...

Off to churn some code,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]