swooboo / HERITAGE

HERITAGE is a text adventure game engine, written in Javascript, capable of interpreting .heritage files.
GNU General Public License v3.0
0 stars 0 forks source link

Using Babel to write with the new EMCA #2

Closed swooboo closed 7 years ago

swooboo commented 7 years ago

Let's discuss using the next generation EMCA for this project. It's easier to write clean and object-oriented code in it, and to support all the browsers there is Babel compiler, read here - https://babeljs.io. @TheLastProject, what do you think?

TheLastProject commented 7 years ago

I personally have no opinion on this, as I've never used anything but plain JavaScript, JQuery and NodeJS. I also haven't done anything serious in JavaScript in months, currently hacking on a Python project, so there's really no useful info I can give here.

swooboo commented 7 years ago

But did you at least briefly go over the Babel page? Do you like how the code looks?

TheLastProject commented 7 years ago

It looks reasonable, I suppose.

swooboo commented 7 years ago

Trying. Having some problems running locally with XMLHttpRequest cannot load file://, it appears that Babel loads 'text/babel' <script> tags with AJAX... Any ideas? See this branch - https://github.com/swooboo/HERITAGE/tree/babel-emca.

TheLastProject commented 7 years ago

I don't really have the time to check now but I believe the original HERITAGE readme says that you can't use Chrome for playing locally as it blocks local URLs and that Firefox should work because the policy is less strict there. You may very well be running into that.

On 22 September 2016 08:40:16 CEST, swooboo notifications@github.com wrote:

Trying. Having some problems running locally with XMLHttpRequest cannot load file://, it appears that Babel loads 'text/babel' <script> tags with AJAX... Any ideas? See this branch - https://github.com/swooboo/HERITAGE/tree/babel-emca.

You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/swooboo/HERITAGE/issues/2#issuecomment-248824597

Sent from my Android device with K-9 Mail. Please excuse my brevity.

swooboo commented 7 years ago

Works like a charm, thanks. I forgot about this...

bd82 commented 7 years ago

For OOO and cleaner JavaScript you may also consider TypeScript. http://www.typescriptlang.org/ http://www.typescriptlang.org/play/index.html

swooboo commented 7 years ago

Thank you @bd82, I'll definitely look into it. If I may ask, why would one prefer it over ECMA6 Script? I'll probably get the answer after some reading, but in this case I'd like a spoiler please :)

bd82 commented 7 years ago

The question is not about ECMAScript 6 vs TypeScript.

If you use Babel you are not using ECMAScript 6. The ECMAScript standard keeps evolving with both of these options you will be using ECMAScript Next. ECMA6 is also known as ECMA 2015, the ECMA2016 spec is already out and a new spec will be released every year hence forth...

ES Next means a combination of features of from future ECMAScript versions.

I Guess the two biggest differences between Babel and TypeScript are:

Either of these options are good and much better then using ECMAScript 5. I'm a big fan of static types so perhaps that is why I prefer TypeScript. Or maybe just because I've used it for a few years now and am simply familiar with it. 😄

swooboo commented 7 years ago

Thank you @bd82, from your explanation I gather that my Babel way fits my needs perfectly. I don't really need static typing in HERITAGE, although it is, indeed, a nice feature. Thanks.