From: "rubyFeedback (robert heiler) via ruby-core" Date: 2023-07-18T18:47:38+00:00 Subject: [ruby-core:114235] [Ruby master Misc#19772] API naming for YARP compiler Issue #19772 has been updated by rubyFeedback (robert heiler). I believe YARP.compile() is a bit of a strange name since it is so specific to YARP. If possible I would perhaps recommend something like the other suggestion: RubyVM::InstructionSequence.compile(yarp: true) Or perhaps another name. Residing under the RubyVM namespace may make sense, so at the least I think this is better than YARP as primary name. You could even just pass in a symbol such as: RubyVM::InstructionSequence.compile(:yarp) (I do not know which alternatives may exist, so please keep in mind that I am solely commenting from an API point of view.) The reason why I come to a similar conclusion as Eregon is mostly because I think this may seem cleaner and may allow for alternative implementations/models too. See the older syck gem, and psych, where ideally the user could just do: require 'yaml' But change the engine if necessary. I used that for a while, before I transitioned into psych completely some years ago. So on the API idea I concur with Eregon; I also think it may be useful if other ruby implementations integrate YARP eventually (jruby, natalie and so forth) or the feature/functionality, however it may be applicable (I am not very familiar with the jruby/truffleruby implementation but they try to stay as compatible as possible with MRI, with a slight implenentation delay normally). ---------------------------------------- Misc #19772: API naming for YARP compiler https://bugs.ruby-lang.org/issues/19772#change-103921 * Author: jemmai (Jemma Issroff) * Status: Open * Priority: Normal ---------------------------------------- We are working on the YARP compiler, and have [the first PR ready](https://github.com/ruby/ruby/pull/8042) which introduces the YARP compile method. Our only outstanding question before merging it is about naming. How should we expose the public API for YARP's compile method? Potential suggestions: 1. YARP.compile 2. RubyVM::InstructionSequence.compile(yarp: true) 3. RubyVM::InstructionSequence.compile_yarp 4. Any of the above options, with a name other than yarp (please suggest an alternative) Regarding option 1, which would mirror `YARP.parse`, is the top level constant `YARP` acceptable? cc @matz @ko1 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/