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: Keith Wright
Subject: Re: Questions about floating numbers, rethink and bug report
Date: Wed, 10 Oct 2001 16:41:37 -0400

> From: Per Bothner <address@hidden>
> 
> 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.

I think you are right, but Guile currently agrees with FORTRAN II
on this point:

guile> (define lotus '#(1 2 3))
guile> (define x lotus)
guile> (vector-set! x 1 666)
guile> lotus
#(1 666 3)

Some implementations would give you a error message to prevent
a seg-fault when you tried to change the program text.  If this
upsets you think of this:

guile> (define (p)
          (let ((lotus '#(1 2 3)))
            (display lotus)(newline)
            (vector-set! lotus 1 666)))
guile> (p)
#(1 2 3)
guile> (p)
#(1 666 3)

-- 
     -- Keith Wright  <address@hidden>

Programmer in Chief, Free Computer Shop <http://www.free-comp-shop.com>
         ---  Food, Shelter, Source code.  ---



reply via email to

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