guile-user
[Top][All Lists]
Advanced

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

Re: Questions about floating numbers, rethink and bug report


From: Per Bothner
Subject: Re: Questions about floating numbers, rethink and bug report
Date: Wed, 10 Oct 2001 09:41:53 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4+) Gecko/20010918

Chris Cramer wrote:

R5RS compliance is great, but I really think that is going too far. If
you do it that way, there's a way to specify read-only literals, but
there's no way to specify writable literals,

There is no such thing as a "writable literal", since a literal refers to the
program text.  There are objects whose value is specified by a literal, or
(if you prefer) literals that are read as writable objects. However, writing to an object that was read from a literal is like replacing the literal "5.0".
While some old Fortran compilers would let you to that, no-one claimed
that as a feature.  It is just made for hard-to-catch bugs.

For instance, in C, you can do

        const static char foo[] = "blah";

which will make it read-only, or you can do

        static char foo[] = "blah";

In Scheme you can do:
   "blah"  ;; constant
or:
   (string #\b #\l #\a #\h) ;; writable
or:
 (copy-string "blah") ;; writable

Similarly, for vectors:
 #(3 4 5)  ;; constant
vs:
 (vector 3 4 5) ;; writable





reply via email to

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