This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: tie variable


Lalo Martins <lalo@hackandroll.org> writes:

> On Tue, Mar 14, 2000 at 04:52:50AM -0500, Keisuke Nishida wrote:
> >   (global-ref user-full-name)
> >   (global-set! user-full-name value)
> > 
> > But this is rather tedious.  I'd like to write:
> > 
> >   user-full-name
> >   (set! user-full-name value)
> 
> One way to make set! work is with GOOPS and generics.
> 
> (define-method set! ((var <emacs-variable>) value)
>     (global-set! var value))

ow.  set! is syntax, not function.

you have a point, though, though I'm not sure you know what it is ;).

here is the point:

Guile has a macro system called Syntax Case.  one of the SC's features
is "symbol macros".  so:

(define-syntax magic-var
  (syntax-case ()
    (magic-var (get-magic-var))))

and you also make sure that `get-magic-var' is a procedure-with-setter.

-- 
You have a tendency to feel you are superior to most computers.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]