Mike Gran <spk...@yahoo.com> 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 behavior. -- David Kastrup