guile-devel
[Top][All Lists]
Advanced

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

Re: string is read-only


From: Maxime Devos
Subject: Re: string is read-only
Date: Wed, 3 Aug 2022 12:59:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0


On 03-08-2022 12:55, Damien Mattei wrote:
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)

Non-empty lists are pairs and the second part of the pair is another list -- in Guile, this is effectively implement as having the second part (the cdr) be a kind of pointer.

Pointers need relocation, so lists cannot be put in read-only sections (unless something like RELRO is used), and in Guile pairs do not have 'am I read-only' metadata (unlike strings).

(My unverified hypothesis on why you aren't seeing an error here.)

Greetings,
Maxime.

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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