unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* string is read-only
@ 2022-08-03  9:12 Damien Mattei
  2022-08-03  9:32 ` Thomas Morley
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Damien Mattei @ 2022-08-03  9:12 UTC (permalink / raw)
  To: guile-user, guile-devel

[-- Attachment #1: Type: text/plain, Size: 824 bytes --]

GNU Guile 3.0.1
Copyright (C) 1995-2020 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (define str2 "hello")
scheme@(guile-user)> (string-set! str2 4 #\a)
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
string is read-only: "hello"

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,q
scheme@(guile-user)> (string? str2)
#t

is it a bug in Guile ? :-O

i can only find reference to deprecated read-only string in old doc:
https://www.gnu.org/software/guile/docs/docs-1.6/guile-ref/Read-Only-Strings.html#Read%20Only%20Strings

Regards,

Damien

[-- Attachment #2: Type: text/html, Size: 1646 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: string is read-only
@ 2022-08-03 11:55 Pierpaolo Bernardi
  2022-08-03 12:48 ` Damien Mattei
  0 siblings, 1 reply; 15+ messages in thread
From: Pierpaolo Bernardi @ 2022-08-03 11:55 UTC (permalink / raw)
  To: Damien Mattei, Maxime Devos; +Cc: guile-user, guile-devel

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]


Il giorno 3 agosto 2022, alle ore 13:36, Damien Mattei <damien.mattei@gmail.com> ha scritto:

>On Wed, Aug 3, 2022 at 12:59 PM Maxime Devos <maximedevos@telenet.be> wrote:
>>
>> (My unverified hypothesis on why you aren't seeing an error here.)
>>
>>
>>  it would be a big change and very strange :-O if the few lines of code
>below in scheme returned an error on lists:
>but no restrictions with lists in Guile:
>scheme@(guile-user)> (define lst '(1 2 3))
>scheme@(guile-user)> (set-car! lst 7)
>scheme@(guile-user)> lst
>(7 2 3)

This is illegal scheme. The  consequences of executing it are undefined.

It's unfortunate that because of implementation limitations many schemes do not detect this error.

>it is interesting ,at the end of page it says too that modifying quoted
>litteral should create an error :-O

It's how all Lisps, including guile, works.  So, yes, if one is interested in these languages, this is interesting knowledge :)


[-- Attachment #2: Type: text/html, Size: 1466 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-08-03 12:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03  9:12 string is read-only Damien Mattei
2022-08-03  9:32 ` Thomas Morley
     [not found]   ` <CADEOadctjXAyZfwYG3Qbky129i0NBbM+HK6g1iUwvA_HrT4UxA@mail.gmail.com>
2022-08-03  9:51     ` Fwd: " Damien Mattei
2022-08-03  9:59       ` Maxime Devos
2022-08-03  9:41 ` Maxime Devos
2022-08-03  9:57   ` Ricardo G. Herdt
2022-08-03 10:55   ` Damien Mattei
2022-08-03 10:59     ` Maxime Devos
2022-08-03 11:34       ` Damien Mattei
2022-08-03  9:42 ` Taylan Kammer
2022-08-03  9:50   ` Jean Abou Samra
2022-08-03 10:30     ` Taylan Kammer
2022-08-03 10:33       ` Jean Abou Samra
  -- strict thread matches above, loose matches on Subject: below --
2022-08-03 11:55 Pierpaolo Bernardi
2022-08-03 12:48 ` Damien Mattei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).