This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-31
Channels
- # ai (5)
- # announcements (11)
- # beginners (19)
- # biff (1)
- # calva (8)
- # cider (3)
- # clj-kondo (12)
- # clojure (97)
- # clojure-europe (39)
- # clojure-nl (1)
- # clojure-norway (74)
- # clojure-uk (35)
- # clojurescript (8)
- # component (8)
- # conjure (4)
- # cursive (13)
- # data-science (1)
- # datahike (55)
- # datomic (2)
- # emacs (3)
- # etaoin (6)
- # gratitude (1)
- # hoplon (12)
- # hyperfiddle (54)
- # introduce-yourself (1)
- # lsp (70)
- # missionary (40)
- # music (1)
- # off-topic (79)
- # re-frame (78)
- # releases (4)
- # sql (5)
- # squint (9)
- # tree-sitter (4)
- # xtdb (20)
I know it's a bit off-topic, but have any of you done anything with Rust-Lang? I am experimenting with it and I am wondering if I am being overly precious in the way I am resistant to some of the aspects of the type system and in particular the way strings work... I can rationalise all of it in the context of type-safety and the compiler, well up to a point anyway, but I keep coming back to the issue that if we can have convenient, uncomplicated Strings in Clojure, why can't they exist in Rust..? I mean is it JUST the compiler / typed axis or is there something else my non CompSci educated ass is simply not grokking..?
you need to be a bit more precise https://doc.rust-lang.org/rust-by-example/std/str.html doesn't make it look too bad, what is the specific bit that is bugging you?
the big difference is probably garbage collection; Java/Clojure has it Rust does not
which means it needs to be Obsessive/Compulsive about not leaking memory
The fact that Strings have to be properly typed as String
or &str
depending on the operations that you want to perform and then possibly re-cast in order to be outputted correctly or match a declared return type. or to be fed into another process / function.
so, &str is just a reference into somebody else's string? and you therefore need to take care • that it really IS a string • that it does not get yanked whilst you are still looking at it?
whereas a a 'String' is mine and mine alone, to dispose as I see fit?
so, slightly pseudo code:
let mut x: String = String::from("Bananas In Pajamas");
x.replace("Pajamas", "Lederhosen")
instead of:oh, BTW is your job title correct and up-to-date?
But yeah, you've answered my question for sure @U793EL04V - it's what I thought, the compiler and the typing and the lack of Garbage Collection are all acting together to make it necessary to have extremely precise definitions of things...
and rust wants to be as performant as possible, whilst maintaining security
whereas java is not so fussed about blinding speed
Oh well, I guess I will just have to adapt / lump it if I am going to use Rust at all. 🙂
oh strange, maybe Slack was showing me a cached version of your user profile...
Clojure -> Rust seems like a big jump what would drive that change?
the restless search for knowledge?
I am working as a Tech Principal, so part of my job is to explore new (to AND) tech and encourage my fellow ANDis (colleagues) to do the same. I ran a poll amongst the Software Engineers in my Club (office) and the most sought after knowledge was Rust, so I am familiarising myself with it a little before launching a Code Dojo focusing on learning Rust that will be a kind of mutual aid / group learning initiative.
I did want to push Clojure, and I am giving a Lightning Talk about Clojure in a week or so, but I also didn't want to ignore the existing enthusiasm for something else 🙂
is rust fully portable? Its billed as a spiritual successor to c++ which makes me think that you have to recompile a program for every architecture you want to run on
presumable threading and i/o is properly standardised
definitely I'd like to learn Rust if I get a suitable gap between jobs
Yeah, like Go-Lang you do need to compile again for the environment that you want to run on, but the received wisdom is that you don't need to alter source code in order to do that, so the hurdle is one of pipelines and infra, not coding.
My early stage take on it is that it's frustratingly precise, coming from Clojure / Python as I am, but it is coherent and as you learn new bits they slot into place with a satisfying "clunk" and the whole language feels very designed without being over engineered.
I will report back once I've actually got past initial learning and actually built something with it.
> if we can have convenient, uncomplicated Strings in Clojure, why can't they exist in Rust As someone not familiar with the language, I've heard Swift has one of the better String implementations. And by that I don't necessarily mean performance-wise, but actually surfacing that Strings are hard (due to extended graphemes, multiple byte representations, logical vs byte comparison, etc). Just a cursory read over https://docs.swift.org/swift-book/documentation/the-swift-programming-language/stringsandcharacters/ shows that they've thought a lot about this and tried to surface it at the API level so that the developer is forced to have an opinion about how they want to deal with it. I think it is interesting from a Rich-style argument of "simple made easy", that the Swift API looks simple while the Clojure API (depending on the host platform implementation) looks complected. This thread is obviously more about the nuance of memory management and safety, so my reply is OT, but this remark about "uncomplicated Strings" reminded me of the problem that Strings are just hard. :)