Jump to content

TYPESCRIPT in Playground


NasimiAsl
 Share

Recommended Posts

8 hours ago, Deltakosh said:

@JohnK I will need your help to document this new way of dealing with the PG ;D

Will do, though I am on holiday for a week or more and so there will be a delay.

 

As a non Typescript user I may have some questions. For example

1. When in JS playground how do you switch to TS playground

2. Would it be possible to have some more examples of TS PGs, such as showing how simple functions would be written and show how new BABYLON methods would be achieved in TS PG. In other words what would these PGs look like with TS

http://www.babylonjs-playground.com/#1ENDNT

https://www.babylonjs-playground.com/#KT9EE7#1 (this type of example could also be useful to show additions work before a PR.)

Link to comment
Share on other sites

Link to comment
Share on other sites

17 hours ago, Deltakosh said:

You just go to the ts.html page to get the TypeScript playground

Understand that but was looking for a lazy way. Something like at the top of examples always have Basic Scene TS and Basic Scene JS underneath that the examples ( when available) grouped by JS and TS. That way there would always be quick access to TS or JS PGs. Also would encourage lazy people like me to check out how to use TS. Do not know how much a problem this would be or where the list of TS playgrounds would come from. 

Link to comment
Share on other sites

I dont know how to feel about this... Why?

This is kinda reminds me of my fear I posted over a year ago, about confusing users as to the basis of the system especially newbies... They are going to get conflicting information and references now and slowly Babylon.js becomes Babylon.ts!

Link to comment
Share on other sites

I think pryme raises a question that I understand

The engine is develop with TS and users use JS. If we find examples ts and js, beginners can be confused or even say that it is too complicated to see this language TS.

Leave TS to the engine developer, and leave JS to the engine users. Otherwise it means that the future examples we will have on the forum when we ask for help will be in TS because those who are more experienced will want to use TS and it will be a real hassle. Others will continue to use JS, but we will find help written in TS and written in JS.

After that, you will also have to open a forum for TS users. I do not even understand the interest of having a PG for TS since Babylon is for JS for the end users, so examples in JS is sufficient.

I'm afraid that in the end we find with full TS example for users and it will be a disaster for sure with requests to convert TS => JS.

Link to comment
Share on other sites

I have been coding nearly 3 years almost entirely in TypeScript, so am biased.  Once a project reaches a certain size, I feel that JS slows me down a lot.

I do agree that there is perhaps not a lot gained in TS playgrounds as they are essentially snippets and I feel that TS doesn't really shine until a project is medium sized.  At the same time I feel this is a REALLY great addition, so thank-you @NasimiAsl - I would really like at some point to post my BabylonJS TypeScript code that does not compile without some trickery (ie: try converting http://www.babylonjs-playground.com/#1K0NSN#1) - and now we finally have a way to share!!  This was not possible before in a PG, so there is something tangible gained by TS playgrounds.

Why not let people choose making playgrounds where they are comfortable and happy --- providing the opportunity for both seems like the right thing.  I have a feeling anybody hanging out in the forum will learn TypeScript by osmosis, so that's a good thing too!!

Also, the TypeScript playground is missing examples, so maybe that's a good teaching tool as well to see the same examples side-by-side.

6 hours ago, Dad72 said:

it will be a disaster for sure with requests to convert TS => JS

I hope not a disaster!  You will find that it's really trivial to convert from TS to JS - just remove some syntactic sugar from variable/function/argument declarations.  TS is just a superset of JS with optional typings :)

Link to comment
Share on other sites

10 hours ago, Dad72 said:

requests to convert TS => JS

Answer with - Remember browsers cannot interpret TS directly and the software running the playground compiles the TS code into JS before rendering. So the easiest way to convert the TS code to JS is to use the zip.jpg.e2970ed860e378497e028041d4c94cee.jpg from the Playground menu. This will give you a complete HTML file with the TS code compiled to JS. Should you wish to learn to code in TS then you will also need to learn the methods used to compile TS to JS for you code to run in a browser.

Link to comment
Share on other sites

I do not like TS programming, I prefer JS directly by using ES6 with "class". I find the JS ES6 programming clearer and more interesting, even for big projects. TS for the big projects is a perfect illusion.

I do not even want to learn TS, if I have to learn a compiler language I'm going to C#, Java, C ++. I choose programming on the internet to avoid compiling language, so TS does not interest me at all.

After, I understand that some people feel more comfortable with this language compiled. But remember that this is not the case for everyone. When I search for a game engine, I search for a engine written in JS, not TS. Babylon is for JS.

Oh and Babylon exists also in C# (whith XNA) for those interested, you have a real language compiled. I have always seen TS as a necessary language compile useless. Javascript ES6 is better now for big project. 

It remains that my point of view, I know that some people will not agree and say that TS is great, but do not denigrate the javascript for as much. Babylon was originally written in Javascript for the sake of Javascript.

I'm not against TS but do not incite the peoples to learn TS because you find it better. There is no language "better "and the JS ES6 is interesting enough for development on the internet.

Link to comment
Share on other sites

5 hours ago, Dad72 said:

There is no language "better "

I agree with you 100%.  I certainly never intended to say that TS was "better" or to incite people to learn TS.  I try to learn as many languages as I can, so I like to share my excitement around different languages - computer and human languages.

Sounds like you are a big fan of ES6.  What you would have said to somebody 2 years ago programming in ES5 for browser compatibility reasons?  I probably would have gently encouraged them to use ES6 and compile the javascript with babeljs, because the classes and arrow functions make programming more fun.  If somebody is happy in ES5 then I respect that choice, too.  Programming in CoffeeScript 6 years ago I was using most of the useful ES6 features, so that was what I used to try to share with people. I think we are all looking for ways to make programming more fun and have cleaner code and I think that sometimes a compiler can help there :) Nothing more than that...

When somebody asks me which wine is the best - I just say it's the one you like the most!  Same with languages.

Link to comment
Share on other sites

On 7/14/2018 at 12:14 PM, brianzinn said:

I agree with you 100%.  I certainly never intended to say that TS was "better" or to incite people to learn TS.  I try to learn as many languages as I can, so I like to share my excitement around different languages - computer and human languages.

Sounds like you are a big fan of ES6.  What you would have said to somebody 2 years ago programming in ES5 for browser compatibility reasons?  I probably would have gently encouraged them to use ES6 and compile the javascript with babeljs, because the classes and arrow functions make programming more fun.  If somebody is happy in ES5 then I respect that choice, too.  Programming in CoffeeScript 6 years ago I was using most of the useful ES6 features, so that was what I used to try to share with people. I think we are all looking for ways to make programming more fun and have cleaner code and I think that sometimes a compiler can help there :) Nothing more than that...

When somebody asks me which wine is the best - I just say it's the one you like the most!  Same with languages.

no.

the list goes:

1:free

2:cold

3: wine of choice

 

Haha just kidding thats just a saying around here.

Link to comment
Share on other sites

On 7/13/2018 at 1:28 PM, Pryme8 said:

I dont know how to feel about this... Why?

This is kinda reminds me of my fear I posted over a year ago, about confusing users as to the basis of the system especially newbies... They are going to get conflicting information and references now and slowly Babylon.js becomes Babylon.ts!

Out with the old in with the new (evil laugh*)!!!

Yea well typescripts the way to go anyway I hear.

:) 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...