[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: Wed, 04 Jan 2012 15:45:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Mike Gran <address@hidden> writes:

> If you follow that logic, then Guile is left without any shorthand
> to create and initialize a mutable string other than
> (define y (substring "hello" 0))
> or 
> (define y (string-copy "hello"))

Sure.  Guile does not have shorthands for _mutable_ literals for lists
or vectors either.  One of the most significant points of a literal is
that you can rely on it staying the same.

> Someone coming from any other language would be surpised to find that
> the above is what you need to do to create an initialize a mutable
> string, I think.

I don't know any language that permits the modification of literals.

> But 'define' just as easily can be considered a generic constructor
> that is overloaded in a C++ sense,

It can be considered a lot of things that don't make sense.

> and when "hello" is a string, y is assigned a copy-on-write version of
> the immutable string.    It was wrong to change this without
> deprecating it first.

Modifying literals _never_ _ever_ was guaranteed to lead to predictable
results.  Undefined behavior before, undefined behavior afterwards.
There is no point in _deprecating_ something that _always_ was undefined

David Kastrup

reply via email to

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