This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-15
Channels
- # babashka (3)
- # beginners (28)
- # calva (8)
- # cider (16)
- # clj-on-windows (4)
- # clojure (69)
- # clojure-europe (29)
- # clojure-norway (42)
- # clojure-uk (4)
- # community-development (5)
- # conjure (3)
- # cursive (18)
- # datomic (68)
- # emacs (23)
- # events (1)
- # honeysql (7)
- # introduce-yourself (1)
- # jobs (1)
- # lsp (11)
- # music (1)
- # observability (3)
- # off-topic (35)
- # other-languages (33)
- # releases (1)
- # remote-jobs (2)
- # ring (18)
- # shadow-cljs (16)
- # timbre (5)
- # tools-deps (9)
looking for something similar to https://github.com/djblue/portal but for python. Any recommendations?
José Valim giving Elixir keynote, explaining how objects leak their identity semantics to their ancestors. There's a lot of kindred spirit between Elixir and Clojure. https://youtu.be/agkXUp0hCW8
And so languages have to add keywords like "protected" just to make up for the new problem objects introduce by leaking their state to ancestors
Anyone uses Typescript extensively? Do you like it/not? Why? And how does it compare to say Java ?
I used to use it extensively.
Liked it well enough but a tight editor integration is needed imo, so you get all warnings/errors while writing your code, not only when compiling/type checking. In VS Code that comes for free.
auto-completions are powerful and a little underestimated in the Clojure community. You don’t have to leave your editor to see what parameters a function accepts or requires and what it returns.
So consuming typescript code is awesome, even if you yourself only write Javascript (assuming the typescript doesn’t lie to you).
Writing typescript can be cumbersome, but being familiar with the most important https://www.typescriptlang.org/docs/handbook/utility-types.html helps a lot, e.g. ReturnType
, Awaited
, Omit
, Pick
I don’t have enough Java experience to make any definite call there. Typescript has pretty good type inference which Java lacked completely when I used it directly, but I think there’s now var
? Also Typescript can lie to you where Java won’t.
Just from a vibes perspective: I definitely like writing Typescript more than Java.
> auto-completions are powerful and a little underestimated in the Clojure community. You don’t have to leave your editor to see what parameters a function accepts or requires and what it returns. Do you need to do that with Clojure?
No and that’s why it’s underestimated.
You think autocomplete is useful in other languages (that aren’t a Lisp)?
Ya, this is where static types are nice, you can get type filtered auto-complete. Where in Clojure it just auto-completes everything that's required.
I do find TypeScript pretty similar to Java, or maybe more C# which in-turn is pretty similar to Java. I think that's kind of the idea. Bring JavaScript closer to Java/C# by introducing class-based OOP.
That said, yes it's about the tools, but the programming language can make making tools harder or easier. In this case, for auto-complete, it's much harder in Clojure, as the tool has an impossible time analyzing the source and figuring out what functions support the type of value being called upon.
In other words, you should also consider a static type checker is just another tool. It runs at dev time, it's there only to help you, it serves no purpose in the actual running application. But such a tool necessitate a lot of annotations, and/or complex non-trivial inference algorithms (which are also restricted by the language to some extent).
> I do find TypeScript pretty similar to Java, or maybe more C# which in-turn is pretty similar to Java. I think that's kind of the idea. Bring JavaScript closer to Java/C# by introducing class-based OOP. > I never associated Typescript with class-based OOP and never wrote a single class in either JS or TS :thinking_face:
I know (part of?) Microsoft uses very OOP flavoured JS and TS but I'd always assumed OOPlers in JS/TS are a minority.
You work with classes in TS?
I don't work extensively with Typescript, so I won't consider myself the authority on it, but most of the typescript I see seems to make extensive use of classes and interfaces. And the general feeling I get is that this is the encouraged way to program in it.
And there's just how it adds back all of the class features to JS. It adds abstract classes, static members, access modifiers, and interface implementation.
"consider a static type checker is just another tool" agreed, and for Clojure we have Spec/Malli and Typed Clojure
Whats an example of something that's being "auto completed" in typescript that isn't in clojure? I assume were talking about this experience?
I think what confuses me is that I have never created a vector (e.g [1, 2]) without some consideration about what i was going to do to it in the first place. e.g map over it.
I'm immediately confused by some of the feedback the typsecript tool chain gives me. For instance, i can't concat these two lists:
and yet it's fine with this:
That's some TS type inference weirdness. When you do [1, 2] it infers this as a homogenous list of numbers. So you can't add string elements to it. When you do [1, 2, "3", "4"], it infers this as a heterogenous list of numbers and strings.
You can probably type hint that [1, 2] should be a list of number and string, and then it won't show you that you can't concat strings to it.
Or a more complex example. Here you say SomeMap has key a and b. So now when you use this map, it auto-completes a and b as keys on it. But you also say that it can have more keys of string -> number. So it lets you add more keys to it as well. It won't let you remove a or b from it though. Those added keys, it cannot auto-complete, because they are dynamically added. Though you could change the type after adding them to a new type that contains them, and that would auto-complete again.