Open ribose-jeffreylau opened 6 years ago
cc: @skalee
Yes, Opal is an option. Though I don't know how heavyweight it is.
Other ideas that come to my mind are:
Opal does have its disadvantages. I've had a little go on it, but it failed to run the translated version of Array#pack
as it's not yet implemented.
Keeping implementations separate could work, and allows for language-specific deviations, but it means giving up DRYness for such flexibility. This is the current state.
Haven't tried Ruby2JS, yet. It also has a list of unimplemented things, but may not matter much in our case.
We already have JS versions of both IdPacker and UuidPacker, so JS -> Ruby is definitely an option.
Interesting idea!
What would be a good way to keep the two implementations in sync?
One way would be to use
opal
, and have it compile the Ruby version to JS.What are other good ways?
Keep in mind that the current JS and Ruby implementations for
UuidPacker
do have some descrepancies. #14