You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some of these types may be implemented in Ruby, so adding interop support could be a bit tricky. In TruffleSqueak, we currently plan to dispatch interop messages directly on the object, so for example Date objects will respond to #isDate and #asDate:.
The text was updated successfully, but these errors were encountered:
It should be fairly easy for Time, which is in core (and considered faster).
Date/DateTime is a stdlib: https://github.com/oracle/truffleruby/blob/master/lib/truffle/date.rb so we'd need to add polyglot_date?/polyglot_time?/etc and polyglot_as_date/polyglot_as_time/etc and implement it there + somehow convert from the very different internal representations.
There are actually quite a lot of date-related messages, notably also isInstant and isTimeZone stuff. Time is using java.time.ZonedDateTime so hopefully it has all of that easily accessible.
I don't think Ruby has any object representing isDuration. Integer/Float are used instead for durations.
So I'd suggest to try to implement date-related messages for Time first, before trying it for date.rb which seems complicated (maybe some of it could be achieved through DateTime#to_time).
Why prefix interop messages with polyglot_ rather than interop_? If someone looks at interop_time?, for example, it might be clearer that it's an interop message.
In TruffleRuby, we consider anything named "polyglot" to be public API, and anything named "interop" to be more internal APIs.
Anyway, such methods are not called by the user, but they can be defined by the user, like
TruffleRuby lacks support for some interop types, for example
Date
:Some of these types may be implemented in Ruby, so adding interop support could be a bit tricky. In TruffleSqueak, we currently plan to dispatch interop messages directly on the object, so for example
Date
objects will respond to#isDate
and#asDate:
.The text was updated successfully, but these errors were encountered: