emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs Lisp and Guile


From: Marius Vollmer
Subject: Re: Emacs Lisp and Guile
Date: 13 Aug 2002 21:13:19 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Richard Stallman <address@hidden> writes:

>     > But I think that running arbitrary code is not good
>     > design--variables should be variables, not act like functions.
> 
>     But they could be used as the basis for all kind of funny
>     variable-like behavior.
> 
> It could be.  I wonder if there is a way to implement this that
> discourages misuse of the feature.

If we would implement this, we could first make it only available to
C.  I expect people to want to use it from Scheme immediately, and
yell at us for not giving it to them.  We could then answer that there
are better ways to achieve the same thing, like settable functions.

> Perhaps, instead of providing a way to say "run this code when there
> is an access to variable FOO", it could have to be done in two steps:
> first, define a feature for something special to do when accessing
> certain variables; second, turn on one of these features for a certain
> variable.

Yes.  I don't understand what you are proposing in detail, but I'm
thinking about adding flags to our existing variables: one would be
for read-only variables, one would be for 'dumb' variables that you
are allowed to access directly (which I think is important for
performance), and maybe others.  When a variable is not dumb, you need
to call scm_variable_ref, etc to access it, and these functions would
then be the single place where new behavior can be added.

If you don't care about performance too much, you can just use
scm_variable_ref, etc without looking at the flags.  Otherwise, the
flags tell you what shortcuts you are allowed to take.

The feature for doing something special would be implemented inside
scm_variabe_ref, etc.  To activate it, you would need to construct a
variable with the right flags.  You wouldn't be able to change the
flags of existing variables.

> Of course, it is possible to write a higher level feature that would
> package up and combine those two steps.  It would not be difficult.
> But many people would get the point and realize that was the wrong
> thing to do.

Yes, the variables that can run code on access need to be specially
constructed.  You wont be able to specify code to be run for an
arbitrary variable.  Sorry if I wasn't clear about this.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

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