[Ironruby-core] "Taint" and (internal) copy constructors

Curt Hagenlocher curt at hagenlocher.org
Thu Oct 25 02:06:17 EDT 2007


Currently, the copy constructors for the MutableString class will "lose" the
taint flag on the string being copied.  One practical consequence of this is
that any builtins that store local copies of the MutableString would have to
manually fix the taint flag.  Wouldn't it be better if the default behavior
were to preserve this information?

Under CRuby,
a = "123"        => "123"
a.taint          => "123"
 a.clone.tainted? => true a[1,1].tainted?  => true

Under IronRuby,
 a = "123"        => "123"
a.taint          => "123"
a.clone.tainted? => true
a[1,1].tainted?  => *false*

It appears that RubyUtils.TryCopyObject is the only place where this flag is
preserved, and this function is called by both Object.clone and Object.dup.

--
Curt Hagenlocher
curt at hagenlocher.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20071024/5842f3f8/attachment.html 


More information about the Ironruby-core mailing list