Proposal: Optional Static Typing (Part 3)
isiahmeadows at gmail.com
Tue Jan 16 20:32:36 UTC 2018
me at isiahmeadows.com
Looking for web consulting? Or a new website?
Send me an email and we can get started.
On Tue, Jan 16, 2018 at 7:44 AM, kai zhu <kaizhu256 at gmail.com> wrote:
> more ranting.
I only partially agree. For most smaller things, and even some
mid-sized projects (e.g. simple DB servers with REST APIs), all you
really need to architect is your API, and the rest will largely fall
out naturally. The front and back end are probably equal in this.
> the “best" architecture/design for any given web-project is whatever ad-hoc hacks/rewrites/fire-fighting it takes to get you past the integration-stage [...]
If it doesn't include a lot of business logic in JS, then sure. I can
tell you my blog, which includes mostly hand-written JS, is a big ball
of mud on the front end. But it works.
That phrase came to be not because of anything about what frameworks
do to your code, but from:
1. The fact that build systems are/were getting unnecessarily complex.
For some communities (React in particular was notorious), it may take
setting up 10+ modules independently, each with non-trivial
configuration, just to get started on the simple stuff.
2. The ecosystem at large was, and still is, churning at such a fast
rate that people were struggling to keep track of it all, and
consequently had issues adjusting to it. React's community was also a
notorious offender for iterating too quickly, but that is at least
starting to settle down.
Neither of these actually directly relate to the code quality
underneath, and even those who enjoyed the frameworks/libraries
themselves were getting tired and stressed over trying to keep up with
First, could you please quit assuming that those companies are the
primary users of things like TypeScript/etc.? I could understand Flow
being very specific to Facebook (it's rarely used outside of Facebook
and React apps), but TypeScript, not so much - it's the 9th most
popular language according to Stack Overflow's most recent Developer
Survey.  At this point, it's about as popular as Ruby, according to
the survey's participants, and there's *no* way that the combination
of the three could account for any more than a small minority of the
- Microsoft developed TypeScript, and has been using it for a while -
this is probably a given.
- Facebook almost exclusively uses Flow - you could've probably guessed this.
- Google internally relies primarily on either GWT (Java to JS) or the
Closure Compiler (uses JSDoc for types) for type checking, and only
last year started allowing unrestricted development using TypeScript.
So the only corporation that could substantially contribute directly
to TypeScript's dominance would be Microsoft, and Google's influence
is more indirect (they use Angular, which bases its entire ecosystem
on TypeScript, but they aren't one of Angular's primary users).
Second, those three aren't even primary users of even Webpack. In
fact, two of Webpack's biggest backers are Adobe and Capital One (yes,
that financial company), each having given $12K to that OSS project.
> what does correlate with successfully shipping a product, is having well-documented endpoint rest-apis, so the frontend-folks aren’t completely clueless during integration when they try talking to the backend, and it doesn’t respond or timeout for some reason. a web-project has a higher chance of shipping successfully if you spend your limited engineering-time doing integration-level documentation and validation-checking (using swagger as shown in following screenshots) instead of code-level OST which nobody talking to your server during integration cares about:
Yes, if you're dealing mostly with clients as a freelancer or
small-time developer. If you're rolling your own data-driven business
or complex web app, types become invaluable. There's a key difference
between doing things for clients with much smaller needs, and doing
things for your own high-tech business. I have experience in both, and
I can assure you, there's a whole world of difference between the two.
For one, ugly hacks work in one-off projects, but not for anything you
have to sustain and put substantial amounts of time to maintain.
> (these screenshots are from real-world endpoint rest-apis that have been documented with integration-level type-checking using swagger - https://kaizhu256.github.io/node-swgg-google-maps/build..beta..travis-ci.org/app/)
> On Jan 11, 2018, at 10:01 PM, Isiah Meadows <isiahmeadows at gmail.com> wrote:
> From a quick read, I'm more in favor of something that's a little more restricted to start, something like what Python has. Python has optional static type annotations, but the Python interpreter just ignores them. They are present purely for the purposes of tooling, and are silently ignored at runtime.
> Conversely, PHP took a similar approach and initially also made it cosmetic to start, only later taking advantage of *some* type annotations by adding runtime behavior to some of the simpler ones (like primitives).
> One of the reasons why I'd prefer a simpler approach to start is that TypeScript and Flow, the two main implementations that add syntax, have a *very* similar syntax, but have several nuances that would make a heavier proposal much harder to accomplish:
> - Flow has `?Foo` for optional types, TypeScript just uses unions.
> - TypeScript has mapped/index types, where Flow uses special named types.
> - Flow allows omitted parameter names in function types, TypeScript only allows named parameters with implicit `any` types.
> - Flow has exact types, TypeScript doesn't.
> - Flow has `opaque type`, TypeScript only has `type`.
> - Flow constrains with `T: Super`, TypeScript uses `T extends Super`.
> - Flow has 3 different ways of importing bindings a module (depending on what's being imported), TypeScript only has one.
> - Flow has existential types, TypeScript doesn't.
> Also, both TypeScript and Flow are still working out how to properly type some of the more advanced JS (like variadic functions and auto-curried functions), so their syntax is *still* not exactly stable enough I'd feel comfortable encoding much into the spec. (They do have a stable core, though.)
> One other thing is that multiple active proposals could end up requiring TS and/or Flow to substantially change parts of their syntax, including:
> - Private [fields] and [methods] (stage 3 and 2 respectively, affects TS)
> - [First class protocols] (stage 1, affects both TS and Flow)
> - [Typed literals] (stage 1, affects TS mostly)
> : https://github.com/tc39/proposal-class-fields
> : http://github.com/tc39/proposal-static-class-features/
> : https://github.com/michaelficarra/proposal-first-class-protocols
> : https://github.com/mikewest/tc39-proposal-literals
> Isiah Meadows
> me at isiahmeadows.com
> Looking for web consulting? Or a new website?
> Send me an email and we can get started.
> On Thu, Jan 11, 2018 at 3:09 AM, Pranay Prakash <pranay.gp at gmail.com> wrote:
>> I'm still yet to read the entire proposal, but with a quick skim, it seems to me like this is essentially what Typescript or Flow offers you: i.e. an opt-in type system?
>> I'm wondering if you have any good reasons to want there to be a standardised static type annotation syntax within ECMAScript instead of a "Bring Your Own Type Checker" system.
>> If you do have some thoughts on this, you might also want to include that as a preface on your Github's README.You have a "Rationale" bit that seems to ignore the existence of these existing systems.
>> Waiting to hear more thoughts on this :)
>> On Thu, 11 Jan 2018 at 11:56 Brandon Andrews <warcraftthreeft at sbcglobal.net> wrote:
>>> It's been a year and a half since my last post and I've made a number of small changes and corrections over 2.5 years. The proposal is still on my github at:
>>> I've talked to a lot of people about it, but I haven't gotten much criticism or suggested improvements. I'm a bit in over my head in trying to flesh out all the details or all the nuanced syntax changes that a championed proposal would be expected to do. That said I've been making more changes lately to try to find edge cases and potential problems.
>>> I've been jotting down issues here: https://github.com/sirisian/ecmascript-types/issues I closed a number of them recently as I made changes.
>>> If anyone has any comments on what I should expand, look into more, or change I'm open to discussing them here or on github.
>>> One issue in particular is this: https://github.com/sirisian/ecmascript-types/issues/15 It covers whether I should introduce a new assignment operator to my proposal. Maybe there's another way to look at it or a different solution. I need fresh eyes on the whole proposal really to get a list of new issues to tackle this year.
>>> I'm also not against having one or multiple people champion it and working on it without me. (I haven't been able to dedicate time to read the ECMAScript spec and really understanding the grammar fully so having someone qualified to take over would help the proposal a lot).
>>> Thanks for reading the proposal for anyone that has the time.
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>> es-discuss mailing list
>> es-discuss at mozilla.org
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss