Comments (5)
The extension syntax
package Java::Object { import => 'java.lang.Object' };
is currently only supported in pre-compilation mode (that is, using -Cjava
).
This is in the documentation (although it could be more clear):
Java extensions are disabled inside eval-string (only plain-perl)
The direction of development for Java extensions is not clear yet.
The current plan is to do something closer to the Nashorn API,
https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/prog_guide/javascript.html#A1147187
but something like JRuby is also possible, https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby
or Jython, http://www.jython.org/jythonbook/en/1.0/JythonAndJavaIntegration.html
Alternately, it would also be possible to make the current extension syntax "official" and go ahead with the integration in eval-string
from perlito.
The JRuby/Jython way looks good:
use java::lang::Object;
but there are many pitfalls in the implementation (namespace conflicts, etc.).
You also may using Perl-ish way, like use if
pragma, e.g.:
use java 'java::lang::Object', as => 'Object';
from perlito.
I've added some more support for Java objects in the eval-string
runtime,
https://github.com/fglock/Perlito/blob/master/README-perlito5-Java.md#java-fields-methods-and-constructors
It is work-in-progress, there is no "new syntax" yet (the examples are using Java::inline
).
I think since the runtime supports the basic operations, we can experiment with several variants of the syntax.
from perlito.
There are some new features available:
https://github.com/fglock/Perlito/blob/master/README-perlito5-Java.md#java-perl-module
Java
is a Perl module: src5/lib/Perlito5X/Java/Java.pm
from perlito.
Typed variables now work in eval-string:
$ jrunscript -cp . -l Perl5
perl> package Java::Object { import => 'java.lang.Object' };
import
perl> my Java::Object $obj = Java::Object->new();
Object(0x4b44655e)
Note that some restrictions apply - https://github.com/fglock/Perlito/blob/master/README-perlito5-Java.md#using-typed-variables
from perlito.
Related Issues (20)
- Error "Unexpected block after expression" HOT 1
- Could perlito compile exiftool to javascript? HOT 2
- "Too much recursion" for the JS backend HOT 3
- Tests fail on perl built with -Duselongdouble HOT 1
- Package org.perlito.Perlito5 does not exist with jrunscript HOT 5
- successive runs of perl code giving different resulsts HOT 6
- Tests for perl 5.26 functionality, while package expects only Perl 5.14 HOT 1
- Getting started? Errors with perl5 HOT 2
- double fat-arrow error
- java "Named capturing group <name> is already defined"
- Java MIME::Base64 breaks in Java9 because missing javax.xml.bind.DatatypeConverter HOT 1
- Code examples on website don't compile HOT 1
- java -jar perlito5.jar -Isrc5/lib array.t failed to run with OpenJDK (not official Java)
- Some Perl6 programs won't compile
- make fails on Ubuntu WSL HOT 1
- can't "make" under Windows 10 w/Strawberry Perl 5.18 x64 HOT 2
- Bareword "Perlito5::Java::pkg" not allowed
- wasm backend ? HOT 4
- Modifying substr expressions evaluate incorrectly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from perlito.