[ruby-core:96666] [Ruby master Feature#16029] Expose fstring related APIs to C-extensions

[email protected] Sun, 05 Jan 2020 00:58:22 +0000 (UTC)
Newsgroups gmane.comp.lang.ruby.core
Message-ID <redmine.journal-83648.20200105005821.ab42d9868fbd0503@ruby-lang.org>
Issue #16029 has been updated by sam.saffron (Sam Saffron).


@byroot, yeah. 

`rb_funcall(str, rb_intern("-@"))` works and is backwards compatible, but I entirely agree that it makes sense to add an official API as well that does not depend on dynamic invocation. 


----------------------------------------
Feature #16029: Expose fstring related APIs to C-extensions
https://bugs.ruby-lang.org/issues/16029#change-83648

* Author: byroot (Jean Boussier)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
As discussed with @tenderlove here: https://github.com/ruby/ruby/pull/2287#issuecomment-513865160

We'd like to update various data format parsers (JSON, MessagePack, etc) to add the possibility to deduplicate strings while parsing.

But unfortunately the `rb_fstring_*` family of functions isn't available to C-extensions, so the only available fallback is `rb_funcall(str, rb_intern("-@"))` which most parsers will likely consider too slow. So the various `rb_fstring_*` functions would need to be public.

Proposed patch: https://github.com/ruby/ruby/pull/2299



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>