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

Re: datum comments of sweet-expressions



On Fri, 12 Jul 2013 10:10:43 -0400, John Cowan <cowan@xxxxxxxxxxxxxxxx> wrote:
> I think the EMPTY tag works
> better.  However, I think the habit of using conses as unique tags
> just makes debugging output hard to decipher.  I much prefer this style:
> 
> (define foo-tag (string-copy "foo"))
> 
> This is guaranteed to return a unique object.

Interesting. I've tended to use conses as unique tags because that ports to
essentially every Lisp in existence, past and present.
Kind of weird to use a string this way, really.

But we'll only use "eq?" on it, so that should be fine.
Okay, I'll give that a whirl.

>  In Common Lisp, this
> is spelled:
> 
> (defconstant foo-tag (copy-seq "foo"))

In Common Lisp I think I'd use this instead:
  (make-symbol "empty-values")
Mentally I think the empty tag is more like a special symbol than a string.
Of course, I can't use Scheme's string->symbol the same
way, because that would *reuse* a symbol of the same name.

--- David A. Wheeler