Earlier quoted context omitted.
“JavaScript’s success is unfair”, sure, whatever. But that’s not the same as “JavaScript is a failure”.
The point is that success sure tastes bitter.
Type-Safe Printf() in TypeScript
21–30 of 82 posts
Re: Type-Safe Printf() in TypeScript
#22Reminds me of Idris: https://gist.github.com/chrisdone/672efcd784528b7d0b7e17ad9c... Recently though, I've been wondering whether advanced type system stuff is the right approach. It usually becomes pretty complicated, like another language on top of the regular language. Maybe it would be easier to have some kind of framework for compiler plugins that do extra checks. Something that would make it easy to check forma…
With the property of verifiably correct behavior
> compiler plugin
A number of languages allow it (Haskell being the most prolific example, but also Java, Scala, gcc, many others)
Re: Type-Safe Printf() in TypeScript
#23[flagged]
Re: Type-Safe Printf() in TypeScript
#24[flagged]
Re: Type-Safe Printf() in TypeScript
#25Earlier quoted context omitted.
> If JavaScript was a failure By almost any reasonable measure it is one of the strongest candidates for “biggest success ever as a programming language”. Sure, you can argue that the reasons for that aren’t mainly language design related, but it is absolutely not anything like a failure.
Pretty easy to succeed when it's the only language a browser supports.
Re: Type-Safe Printf() in TypeScript
#26not sure i understand the utility of this when format strings and string template types already exist. you can also use typescript-eslint/restrict-template-expressions if you find yourself running into problems with that https://typescript-eslint.io/rules/restrict-template-express...
Re: Type-Safe Printf() in TypeScript
#27Except missing the pesky runtime implementation. We don't need though, right? As long as the types say it's right.
The static types depicted in typescript are entirely fictitious. Any similarity to runtime types is purely coincidental.
Re: Type-Safe Printf() in TypeScript
#28Reminds me of Idris: https://gist.github.com/chrisdone/672efcd784528b7d0b7e17ad9c... Recently though, I've been wondering whether advanced type system stuff is the right approach. It usually becomes pretty complicated, like another language on top of the regular language. Maybe it would be easier to have some kind of framework for compiler plugins that do extra checks. Something that would make it easy to check forma…
I wonder if we should have a kind of "hidden type system", where we still take advantage of having a single type system to reason about, but the extra-specific "weird-ish" types can be hidden, almost like private variables, where visibility is literally hidden from the programmer unless obtained from debug modes or errors.
Re: Type-Safe Printf() in TypeScript
#29Reminds me of Idris: https://gist.github.com/chrisdone/672efcd784528b7d0b7e17ad9c... Recently though, I've been wondering whether advanced type system stuff is the right approach. It usually becomes pretty complicated, like another language on top of the regular language. Maybe it would be easier to have some kind of framework for compiler plugins that do extra checks. Something that would make it easy to check forma…
Sounds like comptime from Zig. There are a few others that does something similar, but Zig probably has most mind share right now.
Expressing it in the type system like TS did is impressive, but not simple.