Ok just to FUP... To give food for discussion:
I gave kotlin a few minutes ago a testrun, here is the result:
package test.test2
class TestClass {
val hello: String = "";
fun helloWorld() {
console.info("hello");
}
}
and the resulting Javascript was:
if (typeof kotlin === 'undefined') {
throw new Error("Error loading module 'testkotlin'. Its dependency
'kotlin' was not found. Please, check whether 'kotlin' is loaded prior
to 'testkotlin'.");
}
var testkotlin = function (_, Kotlin) {
'use strict';
function TestClass() {
this.hello = '';
}
TestClass.prototype.helloWorld = function () {
console.info('hello');
};
TestClass.$metadata$ = {
kind: Kotlin.Kind.CLASS,
simpleName: 'TestClass',
interfaces: []
};
var package$test = _.test || (_.test = {});
var package$test2 = package$test.test2 || (package$test.test2 = {});
package$test2.TestClass = TestClass;
Kotlin.defineModule('testkotlin', _);
return _;
}(typeof testkotlin === 'undefined' ? {} : testkotlin, kotlin);
The problem here is that even with a simple class kotlin maps to
kotlin,js instead of just using prototype inheritance or ES6 classes.
if (typeof kotlin === 'undefined') {
throw new Error("Error loading module 'testkotlin'. Its dependency
'kotlin' was not found. Please, check whether 'kotlin' is loaded prior
to 'testkotlin'.");
}
...
var testkotlin = function (_, Kotlin) {
....
TestClass.$metadata$ = {
kind: Kotlin.Kind.CLASS,
simpleName: 'TestClass',
interfaces: []
};
Unfortunately although I am always eager to use a new language Kotlin
for our case due to this fact is a no go:-/
Also the Kotlin.js file has about 35000 locs uncompressed.
Which is a library size which I am not very eager to bundle into a
base lib which should not interfere with other libraries and should
be as small as possible.
Just in comparison the same code compiled from Typescript to javascript
(ES5):
module test {
export module test2 {
export class HelloWorld {
hello: string;
helloWorld() {
console.info("hello");
}
}
}
}
var test;
(function (test) {
var test2;
(function (test2) {
var HelloWorld = (function () {
function HelloWorld() {
}
HelloWorld.prototype.helloWorld = function () {
console.info("hello");
};
return HelloWorld;
}());
test2.HelloWorld = HelloWorld;
})(test2 = test.test2 || (test.test2 = {}));
})(test || (test = {}));
A subsequent use would follow in following code:
var HelloWorld = test.test2.HelloWorld;
var hello;
So I guess the result is as clean as it can be. You can vary es levels
and module systems just by switching the compiler settings.
The Typescript settings were compile target ES5 and no module system
here which will be the baseline for the myfaces impl since the spec
targets a global namespacing.
(ES6 would have produced real classes)
This is just a compiler switch away:
"use strict";
var test;
(function (test) {
var test2;
(function (test2) {
class HelloWorld {
helloWorld() {
console.info("hello");
}
}
test2.HelloWorld = HelloWorld;
})(test2 = test.test2 || (test.test2 = {}));
})(test || (test = {}));
Cheers
Werner
Am 08.10.17 um 16:09 schrieb Werner Punz:
No sync with Mojarra I have discussed that a while ago.
The problem is a licensing problem. Mojarra basically can use
our code but not vice versa, because the CDDL cannot be implemented in
ASF2 code.
The ASF2 license is a very liberal license, but due to the fact that it
is so liberal, it is impossible to integrate less liberal code in our
codebase.
As for your repeated Ajax problems MYFACES-4160 that is a really old
spec bug which reared its ugly head in multiform scenarii.
I worked around that by providing a special config param.
With JSF 2.3 it finally will be fixed.
Werner
Am 06.10.17 um 11:59 schrieb Dora Rajappan:
Thanks for detailing the future of browser and how jsf cope up with it.
I was using mojarra for my application and the commandLink was not
working due to script problem.
So I switched to myfaces and we got some problem with repeated ajax
calls. (Myfaces 4160).
Are we syncing with mojarra regarding the technology to be used with
the jsf.js, entire scripting arena.
Not sure spec say anything about the technology used for scripting.
Thanks & Regards,
Dora Rajappan.