R
RK Sentinel
I'm writing my first largeish app. One issue that gets me frequently is
this:
I define a string in one class. Some other class references it, and
modifies it. I (somehow) expected that when another referer modifies the
reference, ruby would automatically dup() the string.
Anyway, through trial and error, I start dup()'ing strings myself. I am
aware of freeze().
But would like to know how others handle this generally in large apps.
- Do you keep freezing Strings you make in your classes to avoid
accidental change
- Do you habitually dup() your string ?
Is there some clean way of handling this that I am missing.
this:
I define a string in one class. Some other class references it, and
modifies it. I (somehow) expected that when another referer modifies the
reference, ruby would automatically dup() the string.
Anyway, through trial and error, I start dup()'ing strings myself. I am
aware of freeze().
But would like to know how others handle this generally in large apps.
- Do you keep freezing Strings you make in your classes to avoid
accidental change
- Do you habitually dup() your string ?
Is there some clean way of handling this that I am missing.