guile-user
[Top][All Lists]
Advanced

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

Re: defining new character names?


From: rm
Subject: Re: defining new character names?
Date: Wed, 21 Aug 2002 21:06:32 +0200
User-agent: Mutt/1.3.24i

On Wed, Aug 21, 2002 at 01:27:23PM -0500, Lynn Winebarger wrote:
> On Wednesday 21 August 2002 12:33, Keith Wright wrote:
> > > From: Lynn Winebarger <address@hidden>
> > > 
> > > Given the raging debate on this, I'll point out that Chez
> > > Scheme has a function char-name that does this job.
> > 
> > The debate is over a mechanism to define new character names
> > (or possibly more general constants).  This appears to be
> > a function (or macro?) that fetches an already defined
> > character name.  I don't see the relevance.
> 
>       It serves multiple purposes.

I assume this was clear to Keith. 
Still, the name is not really, um, wisely chosen. There's no reason
for not expressing the functions effect in its name. 

 (name-of-char #\tab) => 'tab
 (symbol->char 'newline) => #\12
 (name-char! #\12 #\newline) 
 
>       As for constants, there's no reason to believe we want
> character names to be constant.  There's plenty of reason
> to consider forms for setting constants, but this is not one of
> them.  Consider
> (char-name 'separator #\tab)
>  ....
>          (begin (display (format "~s~s~s" a #\separator b)) (newline))
>  ....
> (char-name 'separator #\space)
> 
> Sure it's ugly, but some people like that sort of thing.

I'd feel uneasy with _that_. Here #\separator is not used as a character
constant but rather as a symbolic constant. Those are semantically different
things. Also, your use would imply that the following works:

 (define (bla blub)
   (char-name 'separator #\tab)
   (display (format "~s~s~s" a #\separator b)) (newline))

which will probably _not_ do what you expect it to do since #\separator
in the display statement will be expanded during _read_ time (when the
program code gets parsed by guile), so the call to 'char-name' at runtime
will not affect it.

   
> 
> > 
> > > (char-name 'paren-close #\051) => unspecified
> > 
> > Now it's got two arguments instead of one.  WTF!?
> 
>      Perhaps you've heard of functions with a variable number
> of arguments?
> 
> > > (char-name #\paren-close) => 'paren-close
> > 
> > Am I meant to guess that the preceding function
> > (macro?) call with too many arguments was actually
> > a definition?
> 
>       Yes, and it's a procedure.
> 
> > I understand it not at all.  Are you sure those
> > examples are correct?
> > 
>      I just hope it's not a copyright violation, as it's almost
> verbatim from the chez user's guide.

I guess Keith is using irony here. The naming really is unusually bad here.
Something (function? macro?) that modifies its parameters usually has a 
name ending in '!'. 

We need to be carefull here to not mix two very different things. Extending
guiles set of named character constants and maybe making this names changeable
(not a bad thing in my opinion) and, otoh, mixing character constants with
symbolic constants (irritating and not neccessary IMHO).

  Ralf
> Lynn
> 
> 
> _______________________________________________
> Guile-user mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/guile-user




reply via email to

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