[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guile: What's wrong with this?
From: |
David Kastrup |
Subject: |
Re: Guile: What's wrong with this? |
Date: |
Thu, 05 Jan 2012 21:24:48 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
Bruce Korb <address@hidden> writes:
> On 01/04/12 15:59, Mark H Weaver wrote:
>> Implementing copy-on-write transparently without the user explicitly
>> making a copy (that is postponed) is _impossible_. The problem is that
>> although we could make a new copy of the string, we have no way to know
>> which pointers to the old object should be changed to point to the new
>> one. We cannot read the user's mind.
>
> So because it might be the case that one reference might want to
> see changes made via another reference then the whole concept is
> trashed?
Yes. Because different references can't be distinguished, it would mean
that you'd not actually have a reference to the modified copy after
modifying it. Which renders the modification useless.
> "all or nothing"? Anyway, such a concept should be kept very simple:
> functions that modify their argument make copies of any input argument
> that is read only. Any other SCM's lying about that refer to the
> unmodified object continue referring to that same unmodified object.
> No mind reading required.
> (define a "hello")
> (define b a)
> (string-upcase! a)
> b
>
> yields "hello", not "HELLO". Simple, comprehensible and, of course,
> not the problem I was having. :)
It is neither simple, nor comprehensible.
> "it goes without saying (but I'll say it anyway)":
>
> (define a (string-copy "hello"))
> (define b a)
> (string-upcase! a)
> b
>
> *does* yield "HELLO" and not "hello". Why the inconsistency?
>
> Because it is better to do what is almost certainly expected
> rather than throw errors.
>
> It is an ease of use over language purity thing.
You probably don't realize how ironic that is.
--
David Kastrup
- Re: Guile: What's wrong with this?, (continued)
- Re: Guile: What's wrong with this?, Bruce Korb, 2012/01/04
- Re: Guile: What's wrong with this?, Andy Wingo, 2012/01/04
- Re: Guile: What's wrong with this?, David Kastrup, 2012/01/04
- Re: Guile: What's wrong with this?, Ian Price, 2012/01/04
- Re: Guile: What's wrong with this?, Bruce Korb, 2012/01/04
- Re: Guile: What's wrong with this?, Mike Gran, 2012/01/04
- Re: Guile: What's wrong with this?, Mark H Weaver, 2012/01/04
- Re: Guile: What's wrong with this?, Bruce Korb, 2012/01/05
- Re: Guile: What's wrong with this?, Mark H Weaver, 2012/01/05
- Re: Guile: What's wrong with this?, Mark H Weaver, 2012/01/05
- Re: Guile: What's wrong with this?,
David Kastrup <=
- Re: Guile: What's wrong with this?, Mark H Weaver, 2012/01/05
- Re: Guile: What's wrong with this?, Mike Gran, 2012/01/05
- Re: Guile: What's wrong with this?, Mark H Weaver, 2012/01/05
- Re: Guile: What's wrong with this?, Noah Lavine, 2012/01/05
- Re: Guile: What's wrong with this?, Mike Gran, 2012/01/06
- Re: Guile: What's wrong with this?, David Kastrup, 2012/01/06
- Re: Guile: What's wrong with this?, Mark H Weaver, 2012/01/06
- Re: Guile: What's wrong with this?, Bruce Korb, 2012/01/06
- Re: Guile: What's wrong with this?, David Kastrup, 2012/01/06
- Re: Guile: What's wrong with this?, Mark H Weaver, 2012/01/06