Patching around String#intern

Hey groovy cats. I’ve decided to stretch myself and start being more
useful to the Ruby community (I hope) by breaking the core.

…I mean, by submitting patches, implementing features I think look
interesting and/or easy to achieve.

I was looking at issue #7795 https://bugs.ruby-lang.org/issues/7795
and decided to implement String#to_existing_sym and String#interned,
which are new methods that act like #to_sym and #intern, except that if
the Symbol doesn’t already exist #to_existing_sym raises an
ArgumentError and #interned returns nil.

Because it deviates a bit from the feature request I’m not going to
submit it as a real patch, but I was wondering if someone could take a
look at what I’ve done and let me know if there are any obvious goofs
(like, missed function registrations, or mismatched types, or things
missing from headers, or other typical core-patching gotchas).

Note: I haven’t built it yet, because I haven’t had a chance to patch it
into a buildable environment like the 2.0.0-p0 source.

I’ve also posted the patch as a gist, if that makes anyone more likely
to browse it. :wink:

https://gist.github.com/phluid61/5086304

Matthew K. wrote in post #1100100:

… and let me know if there are any obvious goofs
(like, missed function registrations, or mismatched types, or things
missing from headers, or other typical core-patching gotchas).

But not typos, I can find them myself.

I’ve fixed the gist.

/spam

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs