Web 2.0 Xojo.js

I don’t know if that has been addressed previously. I checked the Feedback and the Forums, but could not locate an answer.

In Web 2.0 apps, the Xojo.js file that is downloaded to the client declares a XojoWeb variable about 50+ times in a row. Is this a bug? Has this ever been explained, and/or am I missing something here?

Thanks for any insights!

No oficial answer, so I guess the only answer is that Web 2 is still a mess with poor planning and worst execution. They could use more recent standards like ECMAScript 2015 to avoid this kind of problems (variable re-declaration) but… :man_shrugging:t2:

Var is kind of deprecated in javascript this days but Xojo is using it on the javascript web framework and also decided that using it in the languaje will make the languaje look “modern” :roll_eyes: :man_facepalming:t2:

I am pretty sure they use ES6 to develop the Xojo.js framework. And then they use a compiler, like Babel or something, which translates everything into good old vanilla JS. I also think they use Typescript for that, therefore the compiler does even more stuff and it’s ES6-compliant for sure (on development side).

The usage of a compiler also explains why there’s “var” everywhere and no or few “let”. If you scope your code the right way, then var can make sense. It’s definetaly not deprecated, only a bad habit most of the time. :smiley:

To the question of OP:
That is just very bad code design I assume. But it doesn’t affect a thing apart from performance, therefore they didn’t changed/fixed that so far - my guess.

It’s the compiler that does that. There’s one for every class-file we have in the source. It doesn’t hurt anything.

1 Like