[Top][All Lists]

[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 11:54:22 +0200
User-agent: Mutt/1.3.24i

On Wed, Aug 21, 2002 at 10:51:38AM +0200, Matthias Koeppe wrote:
> It would break everything.

I agree with that (see previous post)


> As I wrote before, I believe you are misunderstanding the role of the
> #\ read syntax.  It is not meant as a syntax for character constants;
> rather it is a way to specify literal characters, like
>        #\c

Hmm, what's the difference between 'character constant' and 'literal characters'
for you? The way i understand the '#\...' read extension, it also provides a
mean to ease writing hard-to-write/read character constants (like tab,
space, dc1, page, null etc.). Since it's really hard to read the following
   (if (eq? the-char #\
   ) (display 'yes))

there is the convenience of writing:
  (if (eq? the-char #\newline) (display 'yes))

Now, the notion of 'hard to read/write' character is different for different
users (not _only_ vim users, french/german accented characters can be tricky
too :), so why not extend guiles read options to tailor the set of "named"
characters to the users needs?

> There is also no special syntax for string constants, or integer
> constants in Guile; there only is read syntax for literal strings, like

Are you focusing on the 'constant'-ness?

>         "Error"

_is_ constant, afaik.
and so is 314159265

> and literal numbers, 
>         314159265.
> If you want to create a named constant, you simply do
>    (define error-message "Error")
>    (define scaled-pi 314159265)

No. 'error-message' is not constant after that:

   (set! error-message 'moep?)

> In the same way, you do
>    (define paren-close-char #\051)
> or
>    (define paren-close-char (integer->char 41))
> What I think _would_ be useful for Guile is a new DEFINE form that
> creates constant variables, like DEFINE-CONSTANT, so you could say
>    (define-constant paren-close-char (integer->char 41)).
> This may serve useful for compiler optimizations, because the compiler
> (if any) could assume that the value of the variable never changes.

Yes, but that's an enirely different topic ....


> Regards,
> -- 
> Matthias K?ppe --
> _______________________________________________
> Guile-user mailing list
> address@hidden

reply via email to

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