Live data from Hacker News

What’s New in ES2019

blog.tildeloop.com

31–40 of 411 posts

Re: What’s New in ES2019

#31
post #9

Earlier quoted context omitted.

In other words you’re concerned that some Array methods mutate the array (push, pop) and some don’t (map, concat)? If so then yeah, that can be annoying and/or confusing.

For me the worst is slice/splice.

Kind of stupid, but I imagine the 'p' in 'splice' being an axe that chops the array :D Works for me...

Re: What’s New in ES2019

#34

seems like a real missed opportunity to add string.leftPad()

Seems like a real missed opportunity to look at the Python stdlib and add a bunch of missing functionality to JS so that people don't have to import a metric ton of third party libraries (or worse, write it themselves) to add something you get for free in most other scripting languages.

Even the trim operations they added fall short of the target. In Python (and tcl, by the way) you can specify which characters to trim.

So close, yet, so far.

Re: What’s New in ES2019

#36
post #7

Earlier quoted context omitted.

Mutation is a real weakness of Javascript. I think the general idea is "methods don't mutate unless they are ancient". For example Array.map (an IE9-era feature) doesn't mutate, Array.sort (an IE5.5-era feature) does. Similarly a "for(let i=0; i Proper immutable support (or a stronger concept of const) would also help with this.

> for(let e of arr) e = b Is that just arr.map( e => b ) ?

No, it's broken code and doesn't effectively do anything.

Re: What’s New in ES2019

#37
post #8

That’s a surprisingly small amount of change. I’ll leave it to others to determine if that’s a good or bad thing.

Technically most of this is not even language changes but simple changes to the standard apis. E.g. flatMap is something I've missed and worked around by implementing it myself a few times. Not a big deal and nice that they added it. In any case, I use typescript by default now and have converted most of the code I care about at this point. I think most of this improves typescript as well so; overall a good thing.

Re: What’s New in ES2019

#39
post #6

The part about parameter less catch reveals a lot about the philosophy of the language. For me, silencing error like this is a bad practice. You may still produce a sane error in the catch, but the design goes toward silencing things. I really love languages that force you to handle errors up to the top level.

I see what you're saying - for me, my experience with Java checked exceptions put me off the idea.

In Java it led to lots of exception wrapping and leaky abstractions.

Not sure what the answer is - although my golang experience was better.

Re: What’s New in ES2019

#40
post #7

Earlier quoted context omitted.

Mutation is a real weakness of Javascript. I think the general idea is "methods don't mutate unless they are ancient". For example Array.map (an IE9-era feature) doesn't mutate, Array.sort (an IE5.5-era feature) does. Similarly a "for(let i=0; i Proper immutable support (or a stronger concept of const) would also help with this.

> for(let e of arr) e = b Is that just arr.map( e => b ) ?

Nope. The first does not do anything. The second makes a new array of length 'arr.length' with 'b' in every cell
Post reply on HN