News for hackers. Stuff that matters.
Re:Small Assets without the Headache in Elm 0.19 by eksemplar on Tuesday August 21, 2018 @12:14PM (#17810912)
https://web.archive.org/web/20151029152324/http://ericleads....

https://weblogs.asp.net/bleroy/crockford’s-2014-object-creat...

Once you start doing this, most other languages become obsolete. Because you avoid most of the problems of JS that things like elm try to fix, while maintaining the freedom and also writing a lot less code because you don’t have to write a “recipe” for half the things you write.

The disadvantage of JS is that it’s actually going in the wrong direction. Class is an attempt to copy C-style languages, and that really what you don’t want to do, because as soon as you use inheritance, the “this” keyword or “new” you’re basically doing JAVA/C#/whatever with all the downfalls of JS.

Re:Small Assets without the Headache in Elm 0.19 by tomtheelder on Tuesday August 21, 2018 @01:50PM (#17811994)
Many people (myself included) have never meaningfully used the OOP elements of JS you are referring to. The approaches listed above are common JS patterns and ones that I and I think most JS devs have used extensively.

However, they don't really solve any of the problems that Elm sets out to try and tackle. Do you have any examples?

Also these patterns certainly do not make any other languages obsolete, and as far as I'm concerned it doesn't solve _any_ of the problems with JS that people complain about.

Re:Small Assets without the Headache in Elm 0.19 by boubiyeah on Tuesday August 21, 2018 @01:17PM (#17811627)
JS vs Elm simply cannot be reduced to "classes".

Classes is only a tiny part of what's broken in JS.

TS (coupled to "JS, the good parts") saves the day though, but I have no idea how avoiding classes also somehow made you abandon the usage of a type system (whether Elm's or TS's) It all seems so unrelated.

Re:Small Assets without the Headache in Elm 0.19 by leshow on Tuesday August 21, 2018 @03:09PM (#17812748)
Your comparison doesn't make any sense. You would use a language like Elm/Purescript/Reason etc for the type safety, that's completely orthogonal to whether something has classes or not.
Re:Small Assets without the Headache in Elm 0.19 by eksemplar on Wednesday August 22, 2018 @01:45AM (#17816602)
Except you don’t need typesafety when you do this because you’re never expecting a specific type, and at the same time, you don’t have to waste time writing the recipe for what you’re going to do.
Re:Small Assets without the Headache in Elm 0.19 by boubiyeah on Wednesday August 22, 2018 @04:06AM (#17817137)
You're always expecting a specific type, whether the type or schema is made explicit by the language or not.
Re:Small Assets without the Headache in Elm 0.19 by ww520 on Tuesday August 21, 2018 @12:44PM (#17811215)
That's not classless. It's just class using factory instead of constructor for object instantiation.