N
Navindra Umanee
Hi,
Is it more efficient to use the destructive versions of functions in
Ruby? I know that in Lisp/Scheme destructive counterparts are usually
offered for efficiency reasons.
Can I assume that string.gsub! is preferable to string.gsub when I
know that the side-effect won't be affecting any other code?
I find the Ruby destructive operations sometimes inconvenient to use.
For example strip! might return null where strip would return a
string. However, if it's more efficient, I'd rather use the
destructive version.
Thanks,
Navin.
Is it more efficient to use the destructive versions of functions in
Ruby? I know that in Lisp/Scheme destructive counterparts are usually
offered for efficiency reasons.
Can I assume that string.gsub! is preferable to string.gsub when I
know that the side-effect won't be affecting any other code?
I find the Ruby destructive operations sometimes inconvenient to use.
For example strip! might return null where strip would return a
string. However, if it's more efficient, I'd rather use the
destructive version.
Thanks,
Navin.