[Top][All Lists]

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

Re: What's with `symbol-set!' is deprecated. Use the module system inste

From: David Kastrup
Subject: Re: What's with `symbol-set!' is deprecated. Use the module system instead.
Date: Mon, 05 Dec 2011 09:11:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

David Kastrup <address@hidden> writes:

> David Kastrup <address@hidden> writes:
>> The module system documentation provides _no_ _clue_ _whatsoever_ about
>> how something like
>> (symbol-set! #f (string->symbol name) value)
>> could be replaced.  In fact, the module system documentation provides
>> _no_ _clue_ _whatsoever_ how to actually access module variables short
>> of calling eval on little programs working with symbols.
>> I don't want to call eval for the simple act of setting a symbol to a
>> value.
>> The funny thing is that symbol-fset! and symbol-pset! are documented.
>> But nothing whatsoever that could set a symbol value itself on a symbol
>> that has been generated.
>> What's up with that?
> Well, I disassembled enough to come up with
> (module-define! (current-module) (string->symbol name) value)
> It is not like there is _any_ documentation for this in the manual.
> Is this somebody's idea of a joke?

Apparently.  The C interface offers scm_define which works fine for this
purpose.  But on the Scheme side, there is _no_ equivalent to Lisp's set
(rather than setq or setf).  What is one supposed to do?

(define-macro (mydef! name . rest) `(define ,(primitive-eval name) ,@rest))

Is this supposed to be a puzzle?  Why is there _no_, I repeat _no_
documented way of setting a symbol that is not given literally to a
value?  Neither in the straight way (as with C's scm_define which is a
function rather than a macro and thus useful for this purpose), nor in
connection with modules (since neither module-define! nor module-set!
are documented anywhere).

David Kastrup

reply via email to

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