What is main difference between JSR-223 and JSR-241?
If I understood correctly:
JSR -223: introduces a scripting language engine in Java, thats it! You are free to use whatever scripting language you wants, for ex: Groovy, Mozilla Rhino, PHP, Jython, Python etc. Default implementation of J2EE supports JavaScript as scripting engine, but you can add any scripting language you like. So this was simply to connect the Classes written in Java language with piece of code written in Scripting language (or vice-versa). The only benefit of this integration, I could see is simplicity offered by scripting language in writing a program as compared to writing the same program in Java.
JSR 241: This is extension of JSR-223 and emphasize on adopting Groovy as scripting language, i.e. If you're planning to use scripting language in your Java application (Web or Dekstop apps), use Groovy.. leave others, because Groovy is more Java like and other scripting languages like Jython, Python, JavaScript etc have been adopted and modified to suit Java, but natural choice is Groovy.
Could you please throw some more light on this, and Is my understanding correct?
JSR 241 is not an extension of JSR 223, nor does it "emphasize on adopting Groovy". Instead, its main focus is making Groovy (i.e. its syntax and semantics) an official Java standard in the first place.
The only thing it has to do with JSR 223 is that it's mentioned in 2.6 to clarify why the proposal is not already covered by JSR 223:
Related
A quick glance suggests IBM's, Microfocus's and GNU COBOL's offerings for Java and COBOL interop are all different APIs. However, on Wikipedia there is currently the quote that the 2002 spec "Improved interoperability with other programming languages and framework environments such as .NET and Java."
So what is standardized in this regard? (I do not own a copy of the spec, as I'm just getting into COBOL, and am hoping to explore the Java and COBOL interop, currently as a hobby).
There is a clear answer to the question: No.
There were different things added, especially in the 2002 standard, but also in later standards that would allow a standard conforming API for Java interoperability, but the details of interactions with non-COBOL in the standard is always either processor-dependent or implementation-dependent.
What is defined is actually quite much, things coming to mind:
ENTRY-CONVENTION and CALL-CONVENTION
user-defined functions
object-oriented COBOL with classes, objects, methods, factories, ...
function and call prototypes
defined encoding for NATIONAL and other types
As part of the question may be misleading: GnuCOBOL does not have an API for inter-operating with Java (yet).
If you want to write portable COBOL <-> Java code you can likely use two approaches.
First: use the "C" API offered by Java, the JNI. This will work "quite well" if the COBOL environment can inter-operate with "C" (which is likely true for most implementations).
Have a look for Call c function from Java for details.
Warning: JNI principles should be taken care of, like COBOL called from Java should not STOP RUN (or abend without the chance to catch that on the Java side).
Second: Don't use a direct interface but communicate between COBOL and Java, for example with REST services.
As this also was part of the question: If you want to learn more about what COBOL (as a language, not necessarily supported by "implementor X") then the COBOL standard is a good resource.
In most cases it will be "enough" to just grab whatever the current "draft" of the next COBOL standard is, you can access those at ISO's document page of the COBOL working group [the old versions commonly go away after the standard was published, a new one comes up when the next one is prepared for first public review].
So, I just realized that Java has a built in API system that works with JavaScript and apparently other scripting languages that are JSR-223 compliant. Now, I'm designing a game engine and I'm wondering if I should just use the integrated JavaScript support or figure out how to use Lua.
QUESTION: Can the Java Scripting API easily support Lua? If so, how?
If you feel like it: Would it be unknown to do the scripting side of a game engine in JavaScript?
EDIT: I need scripting capabilities for my engine to allow the creation of AIs, special voxels (Like blocks in minecraft) and other add-ons to the game. I'm not set on doing all this creation in a scripting language because the difficulty of doing so but a scripting language appears as a good alternative to making JARs for all game content. I'm simply exploring what I can do with Java.
The Java Scripting framework relies on the code implementing JSR-223 being written in Java. As such lua won't work.
However, you can use an implementation of lua written in Java such as luaj which has JSR-223 support included.
Note: luaj is not a complete clone of lua but it's pretty functional and allows you access to java classes etc.
On the subject of choosing a scripting language, as you are using Java as your system programming language, some of the benefits of using lua as a scripting language don't apply e.g. fast, small footprint, excellent C integration.
So really it becomes a personal preference. Javascript would be probably be fine, as would Jypthon, JRuby or luaj.
It is not a wise idea to make a game engine in JS. Despite possible(see Node.js / Three.js), JS is rather slow because is interpreted. Node.js has JIT compilation, but it's still 3-4x(best case) slower than C++ equivalent.
I never used Lua or Java Scripting API, I cannot give you an answer on this, but I think the speed of JS will change your mind.
I have a need for providing code snippets at runtime.
For this to work well, I basically need to call into the scripting language, and back into Java. For this to be usable in a debug scenario StackTraces must be usable too (so methods and linenumbers go directly to the script source like in modern JSP-pages) and Exceptions must bubble up correctly.
What scripting languages - where the source is read at runtime - can provide this? JSR-223 support is a bonus.
I think JRuby is best choice because:
Its performance as a scripting language is good.
It can execute in two mode (Compiled, Interpreted).
It supports Ruby on Rails and you can use JRuby for Rails applications in production environments.
You can invoke the classes of the Java Platform easily without any restriction.
I think Groovy would be the perfect fit in your case given it's super similarity and ease of integration with Java not to mention that it's pretty much the most mature JVM language out there with excellent support from the likes of SpringSource.
As an example of JSR support, Groovy has it.
In theory, Dalvik executes any virtual machine byte code, created for example with the compilers of
AspectJ
ColdFusion
Clojure
Groovy
JavaFX Script
JRuby
Jython
Rhino
Scala
Are there already working versions of bytecode compilers for Dalvik available for other languages than Java?
At launch, Java was the only officially supported programming language for building distributable third-party Android software.
Android Native Development Kit (Android NDK) which will allow developers to build Android software components with C and C++.
In addition to delivering support for native code, Google is also extending Android to support popular dynamic scripting languages. Earlier this month, Google launched the Android Scripting Environment (ASE) which allows third-party developers to build simple Android applications with perl, JRuby, Python, LUA and BeanShell. For having idea and usage of ASE, refer this Example link.
Scala is also supported. For having examples of Scala, refer these Example link-1 , Example link-2 , Example link-3 .
Just now i have referred one Article Here in which i found some useful information as follows:
programming language is Java but bridges from other languages exist (C# .net - Mono, etc).
can run script languages like LUA, Perl, Python, BeanShell, etc.
I have read 2nd article at Google Releases 'Simple' Android Programming Language . For example of this, refer this .
Just now (2 Aug 2010) i have read an article which describes regarding "Frink Programming language and Calculating Tool for Android", refer this links Link-1 , Link-2
On 4-Aug-2010, i have found Regarding RenderScript. Basically, It is said to be a C-like language for high performance graphics programming, which helps you easily write efficient Visual effects and animations in your Android Applications. Its not released yet as it isn't finished.
Scala works very well.
I'm programming my Android application projects in Scala (Website written in Chinese with some screenshot, source code # GitHub), and it is pretty easy to setup the evnviroment (without IDE, using SBT as build tool).
It could access every API in Android SDK, so anything you could do in Java, you could do it in Scala too.
You may check this blog entry to see how to build Android application with Scala and SBT.
Kawa is a lovely but little known variant of Scheme that has existed quietly for many years and runs on both the JVM and Dalvik, natively. Therefore, its output includes no extra VM and only includes explicitly imported libraries. To the end-programmer, this means Kawa's performance and executable size are nearly identical to standard Java (ProGuard not required).
Kawa also includes lots of macros (including some specific to Android APIs) that make for a nice clean syntax (assuming one is not averse to parentheses), and adds some tasty goodies on top of Scheme, like "promises" (lazy eval and futures in one). The language is quite robust and well-documented, and has been actively maintained and evolving since the early days of Java.
The Java Advent Calendar summarizes Kawa's merits with some informative examples and links.
I haven't played with it but I know that Scala works.
http://www.scala-lang.org/node/160
Another JVM language that works on Android is Kotlin with Anko, both from Jetbrains.
Mercury also works on Android, using its Java backend. I've written a simple app that should help someone get started (there are still few other examples), and mercury-android-helper also for this purpose (although at this exact moment, it's short a few commits. And neither are using ProGuard yet, so the .apk size is shocking.)
Although the other posts here are cheerful about Scala-on-Android, posters in Scala forums are more concerned by Scala's ability to blow through some of Dalvik's limitations, and people who do use it say they reserve it for non-production code. (Some discussion about Scala's problems here.)
I can't say yet if Mercury has its own problems with Dalvik, but I've switched to it from Scala for the time being.
The dynamically typed languages wont be possible until Dalvik supports JIT (Just In Time) compiling. I believe there is JIT support in one of the experimental Eclair branches, but it is not yet officially available/supported in Android.
1) Angular + nativeScript
2) Reactnative
Somebody talking the python's code can embed into C#'s code. What the mechanism to do that? please explain for me.
Thanks a lot
There are several approaches to this, depending on which languages you want to interoperate with.
.Net/CLR Languages - Iron Python provides an implementation of Python running on the CLR. Allows you to use other CLR assemblies and embed a python scripting engine in your code
Java/JVM Based Languages - Jython provides an implementation on the JVM and allows you to use Java classes and call to call into jython as a scripting language using JSR 223 - Scripting for the Java Platform
C/C++/Perl/etc, etc The Simplified Wrapper and Interface Generator allows you to interop between C based languages and others, including .Net and Java. It's very good for C++, C and COM - other languages are little trickier - but worth checking out if you need to use CPython with .Net or Java
Use IronPython for integration with .net. Likewise, Jython integrates with Java.
And Jython for integration with Java.