- Kyle simpson getters and setters you dont know js software#
- Kyle simpson getters and setters you dont know js code#
At the end of the day, stuff like this is likely to make most JS Devs go “wait, wut?”Ĭonst Task = const GetMilk = Object.
Kyle simpson getters and setters you dont know js code#
Kyle Simpson of the You Don’t Know JS series makes a case for “Delegation-Oriented” Design in “this & Object Prototypes.” This pattern probably would’ve been nicer than the pattern of classes that got popular, but nonetheless, it never caught on as an idiom.īecause of that, there was never really impetus to make that code syntactically more palatable. It’s unfortunately a big source of confusion in the language. prototypical inheritance, new, instance of and class We can do without nully and undefined values, which are part and parcel of the errand that said fool is embarking on - so get rid of ‘em. I think I would claim that the two concepts meaningless to disambiguate, and are statically unenforceable, though I haven’t given much thought to the latter part. If you ask JS devs what the difference between null and undefined are, they’ll likely same something along the lines of, “null is an assignment value, and undefined represents lack of assignment.” The more comfortable it feels, the easier it is to adopt. The idea is to provide something that’s relatable to JS devs. This is a design decision based on the idiom to prefer const. (?) Denoting the union of, “should it” and “I want it to go away, but don’t know if it can”. Here’s a list of things we might cut out, built off of nothing more than intuition, and my observations as a platform engineer for a very website. So what would that intersection look like? How much trimming would you have to do in order to start from something that wouldn’t be “a fool’s errand”? On top of that, another very important question is, “what can we remove that isn’t either loved or ubiquitous in the JavaScript ecosystem?” Ideas
Even Flow doesn’t do this (people will claim that it’s sound it isn’t they make trade-offs in this area as well). Ryan Cavanaugh (TS Development Lead) describes how he views the problem in this very spicy thread:Ī fully-sound type system built on top of existing JS syntax is simply a fool’s errand it cannot be done in a way that produces a usable programming language.
However, A sound type system is a vocal non-goal of Typescript, Flow cares very deeply about soundness, but still makes tradeoffs. Typescript’s famous line that hooked everyone is that “all Javascript is valid Typescript.” And I mean c’mon. This feature separates them in a big way from the manifold compile-to-js alternatives by being much more palatable to users that have invested a ton of resources and time into web-based JavaScript applications. Typescript calls itself a superset, and Flow calls itself a static type-checker.
Probably the most important feature of the Typescript and Flow type-systems is that they are very close to JavaScript.
Kyle simpson getters and setters you dont know js software#
However, so much critical software is written in Javascript that it just kind of feels odd to say out loud. I write stuff in Rust all the time because of similar guarantees. But my first reaction was, “that’s kinda odd.” This is of course not a new idea. We opted to not use Typescript for because we want a sound type system when writing sensitive code. About a month ago, a coworker was updating our team after syncing with a third-party vendor.