From: Dirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Cc: guile-user@gnu.org, guile-devel@gnu.org, mvo@zagadka.de
Subject: Re: Worrying development
Date: Fri, 23 Jan 2004 12:45:37 +0100 [thread overview]
Message-ID: <40110961.1040808@dirk-herrmanns-seiten.de> (raw)
In-Reply-To: <200401221842.KAA20956@morrowfield.regexps.com>
Tom Lord wrote:
> > From: Dirk Herrmann <dirk@dirk-herrmanns-seiten.de>
>
> > What may users of a string data type expect? Shall it be granted
> > that the following expression will always evaluate to true?
>
> > (if (and
> > (not (eq? s1 s2))
> > (equal? s1 s3))
> > (begin
> > (string-set! s2 0 #\x)
> > (equal? s1 s3))
> > #t)
>
>What about:
>
> (if (and (not (eq? l1 l2))
> (equal? l1 l3))
> (begin
> (set-car! l2 'x)
> (equal? l1 l3))
> #t)
>
>
> > My assumption is that most users will assume the above expression to
> > evaluate to true.
>
>When do they need to make such assumptions? Why is it different from
>the case with lists?
>
First: It's not a matter of whether users *need* to make certain
assumptions: It's a matter of interface definition. Scheme defines the
string data type and together with it, it defines the semantics of
operations on it. This gives users a set of properties they *can* rely
on. Certainly, not all of the properties are *needed* in every piece of
code.
The difference with lists is, that lists are not _one_ object, but are
made of several objects. That is, there is no statement saying that two
different lists are independent of each other in the same way that two
strings are independent of each other.
>You say that the old implementation was flawed because it created
>_only_ shared mutation substrings. I don't think that that's a very
>serious flaw. In general, no procedure should mutate _any_ of its
>arguments unless it is advertised as doing so. Consequently, I simply
>shouldn't hand a shared-mutation substring to a mutating procedure
>unless I intend for that mutation to effect all sharing strings.
>
No, I said that the old implementation was flawed because it changed the
semantics of the standard scheme string type. It is certainly all right
if someone wants to use something like shared mutation substrings, but
IMO this should be achieved with a different data type. It may be a good
idea to provide a library for this kind of feature, but it should not
modify scheme's standard string type. Who operates on strings should be
allowed to make all assumptions about string behaviour that belong to
the definition of the string data type.
Best regards
Dirk Herrmann
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2004-01-23 11:45 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-16 9:41 Worrying development Roland Orre
2004-01-16 11:59 ` tomas
2004-01-18 21:05 ` Marius Vollmer
2004-01-18 21:58 ` Tom Lord
2004-01-22 21:47 ` Tom Lord
2004-01-22 16:11 ` Dirk Herrmann
2004-01-22 18:42 ` Tom Lord
2004-01-23 11:45 ` Dirk Herrmann [this message]
2004-01-23 17:16 ` Tom Lord
2004-01-23 21:01 ` Marius Vollmer
2004-01-23 22:18 ` Tom Lord
2004-01-24 0:27 ` Marius Vollmer
2004-01-24 0:53 ` Tom Lord
2004-01-23 22:28 ` Paul Jarc
2004-01-24 12:09 ` rm
2004-01-24 13:29 ` Marius Vollmer
2004-01-26 2:42 ` overriding car/cdr (was: Worrying development) Paul Jarc
2004-02-08 16:21 ` overriding car/cdr Dirk Herrmann
2004-02-08 18:09 ` Marius Vollmer
2004-02-08 20:56 ` Paul Jarc
2004-03-20 22:28 ` Marius Vollmer
2004-03-22 17:05 ` David Van Horn
2004-03-22 21:03 ` Marius Vollmer
2004-03-22 17:24 ` Paul Jarc
2004-01-23 22:37 ` Worrying development Dirk Herrmann
2004-01-23 23:25 ` Tom Lord
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40110961.1040808@dirk-herrmanns-seiten.de \
--to=dirk@dirk-herrmanns-seiten.de \
--cc=guile-devel@gnu.org \
--cc=guile-user@gnu.org \
--cc=mvo@zagadka.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).