Open ggrossetie opened 5 years ago
This is where the pattern getDelegate()
might apply well (like in JPA). We want to step from the generic interface to the vendor-specific interface to access additional implementation-specific methods.
((JRubyAsciidoctor) asciidoctor.getDelegate()).requireLibrary('asciimath')
We could also consider an API where the expected class is passed in:
asciidoctor.getDelegate(JRubyAsciidoctor.class).requireLibrary('asciimath')
If anyone is aware of similar competing patterns, please bring them forward.
asciidoctor.getDelegate(JRubyAsciidoctor.class).requireLibrary('asciimath')
I like this.
Or maybe .unwrap()
instead of .getDelegate()
?
asciidoctor.unwrap(JRubyAsciidoctor.class).requireLibrary('asciimath')
I wonder though if we should make this change with 2.0 and keep 1.6 compatible with the current build plugins. In particular as we already have the RC out.
Yes, this feels 2.0 to me.
Yep, if you've already released a RC then this change shouldn't be part of the final release. AsciidoctorJ 1.6.0 is a "major" AsciidoctorJ but still based on Asciidoctor (Ruby) 1.5.8 ?
AsciidoctorJ 1.6.0 is a major release for AsciidoctorJ to help the transition to the subsequent AsciidoctorJ 2.0.0 major release. You can think of it as early access to AsciidoctorJ 2.0.0. The reason we're making it is to get feedback on the major API changes and so we can make adjustments to get AsciidoctorJ 2.0.0 right. Trying to do this all in 2.0.0 would just be too much.
I expect the bulk of users will transition directly from AsciidoctorJ 1.5.8 to 2.0.0. But 1.6.0 is there to help them get ready.
Specifically:
void requireLibrary(String... requiredLibraries)
void requireLibraries(Collection<String> requiredLibraries)
RubyExtensionRegistry rubyExtensionRegistry()
I'm not really sure how we should handle this case. If a user want to require a (Ruby) library and/or to get the
RubyExtensionRegistry
they can cast theAsciidoctor
interface toJRubyAsciidoctor
and call the methods ? But that mean that they would have to use theasciidoctorj-core
module as a "compile" dependency and not a runtime dependency.Is there a benefit to move all the JRuby related code out of the
asciidoctorj-core
into aasciidoctorj-jruby
?