From: Robert Klemme Date: 2004-10-14T20:59:32+09:00 Subject: Re: Ruby Directions (was Re: quality of error messages) "Markus" schrieb im Newsbeitrag news:1097683458.21256.95.camel@lapdog.reality.com... > On Wed, 2004-10-13 at 02:19, Robert Klemme wrote: > > "Markus" schrieb im Newsbeitrag > > > > > > > > still... for coding, i love slice! / gsub! etc. they are > > > > amazingly useful constructs. i can't imagine living without > > > > them :) > > > > > > The odd thing is, all you are generally getting with them is a bit > > > of syntactic sugar. Consider the relationship between: > > > > > > s = gsub(p,v) > > > s.gsub!(p,v) > > > > > > i = i + k > > > i += k > > > > It's not only sugar. It's different semantics and different performance > > (see the other post with the benchmark). There are enough circumstances > > where you don't know whether someone else still holds a reference to an > > instance at hand. As an example, that's the reason why Strings when used > > as Hash keys are duped and frozen if they are not yet frozen. > > > > Kind regards > > > > robert > > > > In your previous response to this same post you at least included > the rest of my statement: > > > Unless you have lent a friend a reference to s and are using it to > > send secret messages, you aren't really depending on the mutability > > of strings so much as the modifability of variables. > > In my response I further clarified my point, that most users of > gusb! use it not because they want the modification to affect some other > reference to the same string, but simply as a shorthand. Instead of > trying yet again, to clarify a point that we both obviously understand, > I will address a more interesting point: > > Why do you keep taking my remarks out of context to "rebut" them? > > -- Markus I don't consider the difference between "s.gsub!(...)" and "s = s.gsub(...)" syntactic sugar - even in cases where one thinks or knows that the reference was not leaked. So although some bit of context was missing there was no distortion since I disagree with the syntactic sugar thesis for *all* cases. Sadly enough, I get the feeling we're talking across each other. I regret that. robert