Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion flet vars
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Pascal J. Bourguignon  
View profile  
 More options Apr 21 2011, 2:33 pm
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Thu, 21 Apr 2011 20:33:13 +0200
Local: Thurs, Apr 21 2011 2:33 pm
Subject: Re: flet vars
t...@sevak.isi.edu (Thomas A. Russ) writes:

> TheFlyingDutchman <zzbba...@aol.com> writes:

>> > (defvar *x* 'global)

>> How is this is represented internally. Are there now two entries in a
>> symbol table (or similar structure) for "*x*" and "global"? Does the
>> entry for "*x*" point to a 5 cell structure known as a symbol and
>> likewise for the "global" entry. Does the "symbol value cell" of the
>> *x* symbol structure point to the symbol structure for the "global"
>> symbol?

> How this is represented internally is not specified.  

There isn't even an API to know if a symbol has been declared special.
But we can detect it:

(defun specialp (symbol)
  "Detects whether the symbol has been declared special."
  (eval `(flet ((f () ,symbol)) (let ((,symbol t)) (not (nth-value 1 (ignore-errors (f))))))))

(defvar a 1)

(values
 (funcall (compile nil (lambda ()
                         (let ((b 1))
                           (declare (special b))
                           (list (specialp 'a) (specialp 'b) (specialp 'c))))))
 (list (specialp 'a) (specialp 'b) (specialp 'c)))

--> (T T NIL)
    (T NIL NIL)

SPECIAL-ness is a dynamic property, in the global environment.

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.