[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reference variable before definition
From: |
Stefan Monnier |
Subject: |
Re: reference variable before definition |
Date: |
Sat, 11 Mar 2017 22:18:48 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
> 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.
Stefan