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: Tue, 20 Aug 2002 12:18:07 +0200
User-agent: Mutt/1.3.24i

On Tue, Aug 20, 2002 at 10:20:05AM +0200, Matthias Koeppe wrote:
> "Lars J. Aas" <address@hidden> writes:
> 
> > I'd like to be able to do something like this:
> >
> > (define-character "paren-close" #\051) ; 051 is ")"
> >
> > and then later
> >
> > (string-index line #\paren-close)
> >
> > I can of course define a normal variable for this, but then
> > it won't shine from the usage that it is a character in the
> > way the above does.
> 
> Why not use the name `paren-close-character' then.

Because the first solution is read syntax: it's clear that
#\paren-close is a character constant. 

> #\ is read-syntax for literal character constants.  It is not a "type
> annotation".  (If you define constant numeric variables like `pi', the
> name will not start with a digit either.)

Yes, but scheme provides a special syntax for character constants.
I have to admit that i toyed with the idea of extending guiles 
scm_charnames[] array in chars.c myself. My idea was to extend the
table to use the names also used for ISO 8879 character entities 
(mostly known from their use in HTML pages). Since such entities are
specific to an encoding it would make sense to make the table extensible
(i guess this would need to be done by extending the read-options inter-
face).

> 
> I think it's a bad idea to change the language only to make sure that
> a simplistic editor implementation works with it.  File a bug report
> with vim instead; I'm sure it is easy to fix.

Yes, if this would be just to accomodate vi(m) this would be a bad idea,
but this sounds like a reasonable extension to guile (after all: why
#\dc3 but not #\copy ?)

  Ralf Mattes




reply via email to

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