Implement Time.utc
and Time.local
#2223
Labels
A-ruby-core
Area: Ruby Core types.
B-mruby
Backend: Implementation of artichoke-core using mruby.
C-enhancement
Category: New feature or request.
E-medium
Call for participation: Experience needed to fix: Medium / intermediate.
Normally I'd just create a PR for this, however it looks like a not insignificant amount of work in order to get there due to the way the way these functions in the title work.
Docs and context
Ruby Docs Example: https://ruby-doc.org/core-3.1.2/Time.html#method-c-utc
Note: The function can take
1..8
args or 10 args. The errors in MRI for 9 args implies that the 10 arg variant does not exist:The reason for the 10 arg support is so the following function works:
1..8
version is different than in the 10 version variant. Specifically this:How MRI/Mruby handle this
MRI solves this as follows: https://github.com/artichoke/artichoke/blob/trunk/artichoke-backend/vendor/ruby/time.c#L2861-L2870 (just re-order the values if we have 10 args). Called from here: https://github.com/artichoke/artichoke/blob/trunk/artichoke-backend/vendor/ruby/time.c#L3362-L3369
MRuby just ignores the 10 var variant: https://github.com/artichoke/artichoke/blob/trunk/artichoke-backend/vendor/mruby/mrbgems/mruby-time/src/time.c#L492-L503
Solution design
I haven't yet seen places in Artichoke where argc/argv are being passed into the trampoline - and by and large
mrb_get_args
is relied upon for argument checking (and this is still from the mruby source). I think this might be an exception if we're wanting to get to 3.1.2 support, Thus, I think we need aTimeArg
- similar to how MRI does it.The text was updated successfully, but these errors were encountered: