From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!freenix!teaser.fr!newsfeed.stueberl.de!news.netway.at!nmaster.kpnqwest.net!nnum.kpnqwest.net!EU.net!nreader2.kpnqwest.net.POSTED!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: Setting a property in a symbol. References: <6278687.0205260248.625d834f@posting.google.com> Mail-Copies-To: never From: Erik Naggum Message-ID: <3231410756403264@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 22 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 26 May 2002 14:05:58 GMT X-Complaints-To: newsmaster@KPNQwest.no X-Trace: nreader2.kpnqwest.net 1022421958 193.71.199.50 (Sun, 26 May 2002 16:05:58 MET DST) NNTP-Posting-Date: Sun, 26 May 2002 16:05:58 MET DST Xref: archiver1.google.com comp.lang.lisp:33932 * Adam Warner | There is no way using get to distinguish an absent property from one | whose value is default. Yes, there is. Let the default value be a fresh or unique object. This is pretty obvious, so a much better solution to the whole problem is this shadowing redefinition of the standard function: (shadow 'get) (defun get (symbol property &optional default) (let* ((fresh (cons t t)) (prop (cl:get symbol property fresh))) (if (eq fresh prop) (values default nil) (values prop t)))) If this function should not cons, wrap (cons t t) in a load-time-value. -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief. 70 percent of American adults do not understand the scientific process.