This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (4)
- # beginners (110)
- # boot (6)
- # calva (23)
- # cider (14)
- # cljdoc (5)
- # cljs-dev (50)
- # cljsrn (3)
- # clojure (105)
- # clojure-europe (3)
- # clojure-italy (46)
- # clojure-nl (6)
- # clojure-spec (19)
- # clojure-sweden (1)
- # clojure-uk (78)
- # clojurescript (66)
- # core-async (5)
- # cursive (19)
- # data-science (16)
- # datomic (3)
- # events (2)
- # fulcro (11)
- # hoplon (53)
- # jobs (4)
- # jobs-discuss (6)
- # keechma (51)
- # leiningen (3)
- # nrepl (25)
- # off-topic (95)
- # parinfer (8)
- # precept (1)
- # reitit (61)
- # remote-jobs (1)
- # rewrite-clj (75)
- # ring-swagger (2)
- # robots (3)
- # shadow-cljs (43)
- # tools-deps (28)
- # vim (2)
search for “unsound” here (https://www.typescriptlang.org/docs/handbook/type-compatibility.html) for some relevant parts
Oh interesting. I thought Typescript was optionally typed. How does it handle any JS dependencies otherwise? Is it trying to re-impmement a full stack all the way down? And not use any of the JS standard libs?
I thought it was. And a easy way to start is to rename the file extension from js to ts
It is typed js. Like other typed langs, if you don't know the type just specify "any" 😁
The compiler has different options to automatically fill in anything it doesn't know about as any
The type system is unsound, but for the purposes of "tell me wtf this prop obj might be," it's ok
it looks like TLA+ is aimed at the TLA crowd and not a wider audience, i doubt i would be able to get much out of it given that 🙂
Gradual typing means that runtime checks are added at runtime between typed and untyped code as well
So static typed would be that all things must have a type or be explicitly made the type of all types. That type can be inferred, but not inferred to the any type. The compiler would complain for all things that can't be inferred or don't have an explicit type declaration. This would extend to even your dependencies. Thus everything must be typed all the way down and up the stack.
Optional type means that everything is of the type of all types (like any or Object) by default. But if some things are explicitly declared or inferred to be of a more specific type, when they are used with other things that are also declared or inferred to be of a specific type, then the compiler will validate at compile time that they are compatible.
Yup, and gradual is like optional, except that at runtime, it will add a check for things that have a declared or inferred more specific type so that even when used with things of the default compile time type of all types they at runtime are checked against the actual specific runtime type.
I'm wondering what compromise TypeScript made that somehow makes it more likely to be used then TypedClojure. I think its soundness. Because typed Clojure didn't want to compromise on soundness, it had to compromise usability I think
typescript has a ridiculous amount of people working on it compared to typedclojure
Hum... I don't buy that one, unless you can specify what that translates too in terms of features or bugs. Though I could buy into the marketing hour argument 🤑
Given ClojureScript users are already okay using something developed by a minuscule team of open source volunteers.
Ya, I have no doubt that ClojureScript, even if typed, will never compete against TypeScript in total user share
TypeScript's system is quite a bit different than Javas. it supports structural type system and many more dynamic things, e.g. external interface extension (similar to Clojure protocols)
I still consider those simplistic type systems. Maybe Java's is even simpler, but then let's take C#, which supports those. What I mean by complex type systems are when you have support for heterogeneous typed data-structures, support for typing higher order functions, things like that. I mean, maybe TypeScript has that as well.
So, I'm not 100% sure about this. But from what I understand, this is where sound vs unsound comes into play.
For example, with TypedClojure, as I understand, either you can type the function in a way that doesn't allow for any runtime type mismatches, or the function is not typable at all.
But I think I might be missing something here. As I can't really come up with an example of such scenario
But, say I go back to my heterogeneous example. In C# or Java, you would declare it as a List of Object. But in TypedClojure, you can say it's a List of String, Int, or other Maps of Longs and Keywords.
this convo is getting to the point where I don’t know how much more my words can help; maybe try TypeScript out if you’re so interested?
Java is purely nominal typing. TypeScript has great support for structural typing, which is IMO the only thing that makes it tenable to use with existing JS
Okay, interesting. I didn't know that. I do have it on my todo list, but I have a lot of things before that 😋. I'm more fascinated by the motivation of users of JS to adopt TypeScript then TypeScript itself. Since in Clojure land, the promesses of optional types failed to motivate users. And that's purely my curiosity at play, I have no practical reason to need to learn about this.
whoops, sent that before I finished: it’s a bit frustrating to participate in a discussion about it when I say, “here’s my opinion based on my experience,” and you say, “well I don’t buy that”
I don’t take it personally, just giving you the feedback that my desire to continue pontificating about it kind of wore out when it felt like you disregarded my experience without validating it or your own thoughts with a bit of research
Eh, sorry. I can see how it could be frustrating. I was mostly triggered by http://frenchy64.github.io/2018/04/07/unsoundness-in-untyped-types.html and used that as my source of knowledge to start off with.
That article make it sound like TypeScript made some compromise to simplify the Type System in order to provide a better UX to users, at the expense of safety.
I do think that soundness is one attribute that may have contributed to TypeScript’s rise in popularity
Flow is sound, and quite a bit less popular now than TypeScript. but for awhile, it was the de facto standard for Facebook-adjacent projects (since it’s developed by them). it has fallen in favor in the last year or two
some people make the argument it’s the sound vs unsound property of the two, but many others argue that it’s actually due to horrid mismanagement of the team, lack of bug fixes and features, and the state of tooling for it compared to TS now
Which I am still under the impression that it is true. Though I didn't know how complete the type system was. It's possible those simplification are a big reason for it succeeding where core.typed failed as well.
for an example of a completely sound type system with positive uptake, look at ReasonML + BuckleScript
Right, I can see that. I'm just not sure it's true of core.typed. Which is pretty easy to get started with. And the author of it is amazing. But the thing is, I don't know how awesome the TypeScript tooling and experience is. So I should probably try. Maybe if I did I'd realize core.type also lacks polish.
😁 experience trumps theory. would suggest giving it a try on a dummy project. even better if you have a JS project that you can try converting
note I’m definitely not here to shill for TS. ultimately, I didn’t find it as productive as Clojure(Script) nor as compelling in terms of future-state as ReasonML + BuckleScript. but if I needed to wrangle some JS project at work, it would be my choice of tool
Ya, actually you motivated me to try Typescript a lot more. So I'm going to have and bump it up a few notches on my todo list 👌
Reason and BuckleScript look awesome. Though for now, I'm still a Clojure/Script fanboy. What I've been wondering is if that last remaining itch for types when using Clojure/Script could be scratched if it had a type system inspired by TypeScript, which might be unsound in places, but because of it, could provide much better convenience and usability. Anyways, I'll stop bothering you 😁, and I'll investigate TypeScript first by trying it before I comment on it anymore. Thanks again. Sorry if in parts of it I sounded a bit stubborn and misguided.
Though, maybe having Microsoft add types to all of the core JS libs, where in typed Clojure, no one spent the time to do that plays a big role. And that could be attributed to dev power maybe
The biggest issue I've heard from people who used Typed Clojure in prod is that it just wasn't worth the effort
Like they found it provided little value, while adding too much overhead when coding.
I wouldn't be surprised if most people who like TypeScript is just because of auto-complete in IDE 😋
Personally, that's also like the only thing I miss in Clojure when it comes to types. Its not really the type checking, but the possible tooling support
I feel knowing that not everything has to be typed, I'd be worried and still would do a regex search over the project just in case.
Ya, I guess so. Even in Java I always do a regex search as well, because there's always one or two weird reflective access or just plain strange use that the refactorer misses on. And there's the issue of dependent packages too.
i still typehint whenever i feel there's a need .. but i get more and more often annoyed in java-land when i have to generate useless types and subclasses just to get through some gates
my point is that: even if TypedClojure and TypeScript are built on the same concepts, that the amount of features and polish that TypeScript can deliver is going to be far above what TypedClojure can deliver
so TypeScript being able to say, "We've developed enough features into the type system that we can infer 80% of the types, 10% of the types you need to be explicit, and the other 10% you just
"also, our dev tooling is very fast and gives good feedback, with lots of documentation + resources to help solve common issues"