<kares[m]>
interesting that the ruby spec suite ends up hanging - even when restarted
<headius[m]>
Jules Ivanic (Gitter): We have our own instruction format and compiler/optimizer, which feeds into the interpreter, and eventually JITs to JVM bytecode
<headius[m]>
kares: Gitter integration just started working
<headius[m]>
your messge and mine went through
<kares[m]>
headius: that is weird since I do not see it among integrations
<headius[m]>
I see it
<headius[m]>
in the room anyway
<headius[m]>
"Gitter Integration"
<kares[m]>
oh really?
<kares[m]>
interesting
<kares[m]>
we should see the same but smh don't :)
<FlorianDoubletGi>
We can do something like `a_ruby_datetime.to_java(java.time.ZonedDateTime)` but once we have a java `ZonedDateTime` ( for example ) can we do something like `.to_ruby` to get back a ruby `DateTime` ? :/
<FlorianDoubletGi>
One solution could be to do something like `DateTime.parse(myJavaZonedDateTime.format(DateTimeFormatter.ISO_DATE_TIME))` but here i'm looking for a more efficient way to do it, if it's possible. Thanks !
drbobbeaty has joined #jruby
<headius[m]>
You know it occurs to me, we do have the ability to coerce to different types, and since we depend on Java 8 now one of those types could be Java 8 date time
<headius[m]>
kares does our to_java already handle the java 8 date time?
<kares[m]>
headius: we already coerce to Java 8 date-time types
<kares[m]>
yep we did that around 9.2.1
<headius[m]>
So if you specify it it, ok
<kares[m]>
yeah that works they're asking for the other way around
<headius[m]>
Maybe we need to finally introduce a to_ruby protocol
<headius[m]>
I have thought about this before. The problem is ideally we want something we can cache, so we want to know both what types we can coerce to, and then have a method to actually do the colors
<headius[m]>
This plays into dispatch and other things too
<headius[m]>
I suppose it would be simple enough to add a from_java to Time or Date too
<headius[m]>
Or we can just break joda compatibility in 9.3
<kares[m]>
headius: for 9.3 it might be viable to try to break, altough its possible to maintain backwards compatibility
<kares[m]>
somehow Java 8 types are more verbose than joda's DateTime
<headius[m]>
There's a few places that will be a problem but yeah most things I think we can convert transparently
<kares[m]>
but it should be doable ... truffle does it
<headius[m]>
Well, they just use it internally. Who knows how the polyglot stuff deals with dates and times
<kares[m]>
the question is mostly about having some factory methods somewhere to convert from Java types -> to Ruby
<headius[m]>
Stephen C who wrote jodha also worked on the java 8 stuff
<kares[m]>
which we kind of have e.g. RubyArray ctor accepts a Collection
<kares[m]>
same for RubyHash
<headius[m]>
Too bad you can't get to railsconf, I feel like we need a jruby core meeting
<headius[m]>
Maybe we should just come to you
<kares[m]>
yeah I would have love to catch up with you guys
<headius[m]>
Or I should have been more on the ball and tried to officially arrange something during railsconf
<kares[m]>
no biggie
<kares[m]>
I forgot about it as well
<kares[m]>
than realized a few weeks back that I might go -> forgeting I made other plans near by :)
<kares[m]>
I am sure you guys will be around in EU
<kares[m]>
anyway tha requirements feels like having a factory the problem is that there's at least 3 date/time types we Java convert ruby Time/DateTime to
<headius[m]>
I will submit something for joker in St Petersburg, and then see what's happening around the same time or just make a few stops on the way home
<headius[m]>
So, this fall at the latest
<JulesIvanicGitte>
> We have our own instruction format and compiler/optimizer, which feeds into the interpreter, and eventually JITs to JVM bytecode
<JulesIvanicGitte>
Can we launch the compile phase during a Docker image build ? So, the docker image already contains the compiled version ?
<FlorianDoubletGi>
Ok I understand, so for now it's not directly possible. thanks @headius and @kares
<kares[m]>
its mostly a JIT (just-in-time) not ahead of time :)
<headius[m]>
Jules Ivanic (Gitter)
<headius[m]>
Oops
<headius[m]>
So what you really want is an ahead of time compiler, which we do have in a way but it's not well integrated into Ruby code loading and such
<kares[m]>
Florian Doublet (Gitter): we could add some APIs on RubyTime
<kares[m]>
feel free to open a feature request
<headius[m]>
kares I think the right way forward for pre compiling is 2 always search for .RB but then look for a precompiled .class next to it
<headius[m]>
We already have disabled the logic to look for both, and that was never really the right way to do it anyway
<kares[m]>
Florian Doublet (Gitter): sounds like you want this in Ruby land, you're scripting the conversion not using it from Java, right?
<headius[m]>
If people want to pre compiled for obfuscation, we can scrub the Ruby source and make it explicitly load the class file
<kares[m]>
headius: oh, its disabled? thought its enabled
<kares[m]>
warbler uses it
<headius[m]>
You have to turn it on or it doesn't look for class files
<kares[m]>
wait, no since it replaces .rb with .class loads
<headius[m]>
0 bug reports
<kares[m]>
yeah - it would not make sense
<headius[m]>
We disabled it cuz it was yet another file system hit in load service
<headius[m]>
But if we require that the Ruby source or some Ruby source is always there, then it would be trivial to look for a class file next to it
<headius[m]>
Jules Ivanic (Gitter) are you interested in this for start-up or obfuscation or what?
<JulesIvanicGitte>
> Or we can just break joda compatibility in 9.3
<JulesIvanicGitte>
+1
drbobbeaty has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<JulesIvanicGitte>
> its mostly a JIT (just-in-time) not ahead of time :)
<JulesIvanicGitte>
Ok thanks for the answers :)
<FlorianDoubletGi>
> Florian Doublet (Gitter): sounds like you want this in Ruby land, you're scripting the conversion not using it from Java, right?
<FlorianDoubletGi>
@kares yes that's it :)
<FlorianDoubletGi>
(edited) > Florian Doublet (Gitter): sounds like you want this in Ruby land, you're scripting the conversion not using it from Java, right?
<FlorianDoubletGi>
@kares yes that's it :) => @kares yes that's it :)
<FlorianDoubletGi>
> Florian Doublet (Gitter): sounds like you want this in Ruby land, you're scripting the conversion not using it from Java, right?
<FlorianDoubletGi>
(edited) @kares yes that's it :)
<FlorianDoubletGi>
> Florian Doublet (Gitter): sounds like you want this in Ruby land, you're scripting the conversion not using it from Java, right? => > Florian Doublet (Gitter): sounds like you want this in Ruby land, you're scripting the conversion not using it from Java, right?
<FlorianDoubletGi>
@kares yes that's it :)
<headius[m]>
We have talked about implementing a more extensible protocol for automatic type conversions
tlarevo has joined #jruby
<kares[m]>
that can be done using `Time.new` but maybe a `Time.from_java` would be better
<kares[m]>
I mean not now - but `Time.new` could be smart about detecting Java types
<kares[m]>
altough its a bit ugly to do so ...
<headius[m]>
Yeah, that is much cleaner in Ruby code, but I feel like being explicit is better 🤷♂️
tlarevo has left #jruby [#jruby]
<headius[m]>
Actually, maybe it would make more sense to just add to_ruby to a key Java class?
<headius[m]>
It kind of feels like we have to do this for all sorts of types, but really we just want to weigh convenience methods for equivalent classes in Ruby. That's a limited number.
<JulesIvanicGitte>
> Time.new could be smart about detecting Java types
<JulesIvanicGitte>
I prefer explicitness other “smartness"
<JulesIvanicGitte>
plus, it’s not an official Ruby behabior
<JulesIvanicGitte>
the annoying kind of explicitness
<kares[m]>
since we're talking ruby land here and most of the Java types follow the to_x conventions e.g. `List#to_a`, `Map#to_h` or `java.lang.Integer#to_int` ... I would be inclined for the Java date-time types to add `to_time` (`to_date`) where appropriate
<kares[m]>
that way we do not "pollute" the ruby types nor existing APIs need a special behavior
<kares[m]>
and I think we're already loading Java class exts on demand (as those types are used) so this is fairly straightforward and could land in next 9.2 release
<kares[m]>
also, reminds me that I wanted to have `BigDecimal#to_d` to get a Ruby Decimal
<headius[m]>
Right that seems good
drbobbeaty has joined #jruby
shellac has joined #jruby
<CharlesOliverNut>
Apparently Square still has JRuby and a bunch of folks at Ruby Kaigi use JRuby or are interested
<kares[m]>
nice!
<CharlesOliverNut>
Ruby is apparently still the primary language at Square too
<kares[m]>
oh really?
<CharlesOliverNut>
yeah, according to havenwood it is actually influencing how they build stuff in their JVM languages
<CharlesOliverNut>
need to get out there to chat
<CharlesOliverNut>
Also hear there's some JRuby at Shopify but unclear how much
<kares[m]>
I have seen a report from a Shopify person
<kares[m]>
but I did not ask whether its work or just experiments
<kares[m]>
Shopify would be such a great fit but than again they already have an architecture around CRuby
<headius[m]>
yeah what I heard some time ago was heavily threaded email services or something
<headius[m]>
it's always startup that kills us
<headius[m]>
I really want to see if we can get JRuby to native compile with GraalVM
<headius[m]>
we could precompile stdlib + gems to JVM bytecode and AOT the whole thing and probably start up like crazy
<kares[m]>
okay, java.math.BigDecimal#to_d is ready, now let's experiment with `to_time`
<headius[m]>
👍
<headius[m]>
the gitter connection is a bit flaky
<headius[m]>
my thumb shows up but not kares message