mast / telegram-bot-api

First Telegram Bot API node.js library
http://mast.github.io/telegram-bot-api/
MIT License
246 stars 64 forks source link

Migrate to es6 #11

Closed AliMD closed 8 years ago

AliMD commented 8 years ago

I want to rewrite code to es6 with babeljs. Make a pull or own repo ?

mast commented 8 years ago

I want to keep it as node.js module, and as far as I know es6 is very poorly supported by nodejs right now. So there are 2 options:

AliMD commented 8 years ago

Please check this website babeljs.io I think you don't really know it It fully compatible as a simple node.js module

On Mon, Jul 27, 2015, 6:14 PM Max Stepanov notifications@github.com wrote:

I want to keep it as node.js module, and as far as I know es6 is very poorly supported by nodejs right now. So there are 2 options:

  • we do that as separate branch, or
  • you do it as separate repo

— Reply to this email directly or view it on GitHub https://github.com/mast/telegram-bot-api/issues/11#issuecomment-125208431 .

derhuerst commented 8 years ago

Even though using babeljs with regular Node.js is possible, why not wait until ES6 is natively supported?

AliMD commented 8 years ago

Es6 work a polyfill in next 3 years And babeljs not a converter it rub es6 on the fly Check my bot source code and read more about babeljs and/or typescript https://github.com/AliMD/OneCastBot

On Mon, Jul 27, 2015, 10:19 PM Jannis Redmann notifications@github.com wrote:

Even though using babeljs with regular Node.js is possible, why not wait until ES6 is natively supported?

— Reply to this email directly or view it on GitHub https://github.com/mast/telegram-bot-api/issues/11#issuecomment-125285327 .

derhuerst commented 8 years ago

Es6 work a polyfill in next 3 years

What do you mean by that?

And babeljs not a converter it rub es6 on the fly

It is a converter. It works like coffee-script/register.

AliMD commented 8 years ago

Check my repo, it's work without convert, not like coffee For example let work as let not as a var

On Mon, Jul 27, 2015, 11:45 PM Jannis Redmann notifications@github.com wrote:

Es6 work a polyfill in next 3 years

What do you mean by that?

And babeljs not a converter it rub es6 on the fly

It is a converter https://github.com/babel/babel/blob/master/packages/babel/src/api/register/node.js. It works like coffee-script/register https://github.com/jashkenas/coffeescript/blob/master/lib/coffee-script/register.js .

— Reply to this email directly or view it on GitHub https://github.com/mast/telegram-bot-api/issues/11#issuecomment-125311272 .

mast commented 8 years ago

Ok, I got it now. So we can create es6 code and use babeljs for getting it executed with node at run time (as I see you managed to get it working in your referred repo). Mainly I agree with @derhuerst and probably it's better to wait for native es6 support. But give me a chance to think about it a little bit more. By the way what benefits of using es6 in bot api you see, @AliMD ?

derhuerst commented 8 years ago

@AliMD

Check my repo, it's work without convert, not like coffee

In your repo, you require babel/register, which registers a hook that converts ES6 into ES5 (on the fly), just like CoffeeScript.

Es6 work a polyfill in next 3 years

Since io.js is close to 3.0.0 and brings native ES6 support, I don't think it's going to be 3 years, rather a few months. That's the reason I propose to wait with the migration until ES6 is natively supported.

AliMD commented 8 years ago

sorry, 3 years just for browser not node ;) By the way i start it as my own repo and will continue this conversation after some time Thank you

AliMD commented 8 years ago

@derhuerst Its time to use es6 ;)