Hacker Newsnew | past | comments | ask | show | jobs | submit | jestar_jokin's commentslogin

As you say, it's just a matter of familiarity. Sounds like you just need exposure to more programming languages/paradigms, as it's a pretty common convention. I believe it comes from the ML family. OCaml[0] springs to mind. As others have mentioned, Rust[1], Kotlin[2], Haxe[3], Nim[4], Swift[5], Elm[6], Dhall[7], and Scala[8] all use this convention.

The current syntax seems better for type inference and gradual typing.

[0] https://learnxinyminutes.com/docs/ocaml/

[1] https://learnxinyminutes.com/docs/rust/

[2] https://learnxinyminutes.com/docs/kotlin/

[3] https://learnxinyminutes.com/docs/haxe/

[4] https://learnxinyminutes.com/docs/nim/

[5] https://learnxinyminutes.com/docs/swift/

[6] https://learnxinyminutes.com/docs/elm/

[7] https://learnxinyminutes.com/docs/dhall/

[8] https://learnxinyminutes.com/docs/scala/


Sounds like a problem with some API trying to make everyone happy.

Could be avoided by having more functions, one for each case.

(Only if you control the code, of course.)


I know Tom Scott, known now for his YouTube videos, was on the forums (I produced a remix for a charity single he made). He's turned out overwhelmingly wholesome and level-headed.


There's libraries that let you define a schema programmatically, and then infer the types.

https://github.com/sinclairzx81/typebox


So a candidate has to know someone who's already in the company? Which means they probably went to the same school/uni. Rough for anyone outside your bubble.

Or they cold-call people at the company, hoping to get the goss. Staff knowing about the candidacy should not respond. Others would hopefully be suspicious - how can you trust staff who tell company problems to any old "candidate"?


Are they also going to remove Python, Ruby, NodeJS, PHP, and every other programming language runtime? Why not?

Hopefully Graal gets more traction, so these Java (and Ruby, NodeJS, Python etc) apps can be compiled to native code, if just to bypass odd decisions like this.


Libs provide something out of the box to do this, e.g. `ts-essentials` provides `Opaque`, so you just write `type DateString = Opaque<string, 'DateString'>`


Their version is essentially my Symbol approach, but only in the type system. This does work, but it has the disadvantage that the type and runtime don't match. It’s certainly better than most Brand types which tend to rely on strings, but I prefer not to expose public properties which don’t exist.

The class/private approach has the advantage of hiding the extra property from everything except the type checker.


No good if you need to convert between time zones, IME.


date-fns does not support time zones, so it's not really comparable.

(Although it looks like `js-joda` doesn't contain the time zone database, for that you also need `@js-joda/timezone`, and the IANA TZ DB as generated by `moment-timezone`. Oh boy!)


Windows 8 really broke the UI, to support tablets, and the OS has never recovered. :(


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: