Re:Porting a React Front End to TypeScript
by joelbluminator on Tuesday April 28, 2020 @03:01AM
(#23004282)
Are you talking about using Optional or things like that in java? That's pretty recent so you can't say that's a property of a static language. And it brings its own problems with it.
[ Parent
| on HN ]
Re:Porting a React Front End to TypeScript
by cageface on Tuesday April 28, 2020 @03:16AM
(#23004360)
What problems does it bring with it? It's just a tool that automatically tells you where you need to deal with possible null values. It's far easier than trying to catch every possible place this can happen with loads and loads of manually written tests.
Not all static languages give you this but the trend is pretty clear with Typescript, Swift, Kotlin etc.
Re:Porting a React Front End to TypeScript
by joelbluminator on Tuesday April 28, 2020 @03:23AM
(#23004399)
I can't say the use case for Optional is even well defined https://stackoverflow.com/questions/26327957/should-java-8-g... . I'm no good in java, this is just what I find on the web.
Re:Porting a React Front End to TypeScript
by cageface on Tuesday April 28, 2020 @03:35AM
(#23004490)
Have you actually worked in a language with good, first-class null handling? I'm not surprised that something tacked onto java very recently is awkward to use but in Swift or Typescript it's much easier than wrapping if foo.nil? calls everywhere and much more effective.
What? The use case for an optional type has been been documented for decades and iirc is sourced from type theory. See it’s usage in Haskell (Maybe type) as one aged example. Also, that stack over flow is pretty well clear on what it should be used for imo.