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 getting a full symbol name
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
 
Barry Margolin  
View profile  
 More options Apr 29 2000, 3:00 am
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@genuity.net>
Date: 2000/04/29
Subject: Re: getting a full symbol name

In article <8eff72$cj...@nnrp1.deja.com>,  <wnew...@my-deja.com> wrote:
>Isn't printing :FOO instead of KEYWORD:FOO already a special case?
>As long as you do this special thing, it's arguably simpler
>to do it always instead of only doing it sometimes.

As I said above, it depends on where in the process you implement the
special case.  The logic could be:

(unless (symbol-in-package sym *package*)
  (princ (package-prefix sym)))
(princ (symbol-name sym))

where the PACKAGE-PREFIX function implements the special casing of the
keyword package.  Or the logic could be:

(cond ((eq (symbol-package sym) *keyword-package*)
       (princ ":"))
      ((symbol-in-package sym *package*)
       (princ (symbol-name sym)))
      (t (princ (symbol-package sym))
         (princ (double-or-single-colon sym))
         (princ (symbol-name sym))))

>I wish the KEYWORD package were a little more special, actually.
>I've been trying to decide what the SBCL interface for
>profiling and tracing should look like. It's based on the CMU CL
>TRACE code, and the CMU CL TRACE interface is basically nice, but
>relies heavily on the assumption that a keyword is not a function
>name, which as far as I can tell is not something which ANSI
>guarantees. So do I compromise the expressive CMU CL interface
>just to support people who want to
>  (defun :foo (x) (1+ x))
>  (trace :foo)
>Almost certainly, since I like systems to conform to standards.
>But it seems irksome in this case..

I don't think the specification prohibits defining keywords as functions,
but realistically it's not a smart thing to do.  The point of the package
system is to prevent unrelated pieces of code from interfering with each
other, but if two programmers both decide to define :FOO they'll clobber
each other when both applications are loaded into the same image.

This is very similar to the reasoning behind all the restrictions on the
COMMON-LISP package; perhaps we should have said something similar about
keywords, but just never thought of it (the COMMON-LISP package is more
critical, and impacts whether the implementation can can use it internally
or must have its own internal parallel sets of functions).

I'm not familiar with the CMUCL trace implementation, but I wonder why they
needed to use the keyword package, rather than some internal package of
their own.

--
Barry Margolin, bar...@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.


 
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.