2 ms·
I assumed scheme and lisp were the same here semantically. Bad assumption on my part. My experience is primarily with scheme. Similar Rust and Swift allow let
by dcow 4y ago
I assumed scheme and lisp were the same here semantically. Bad assumption on my part. My experience is primarily with scheme.
Similar Rust and Swift allow let bindings to be shadowed but you need to re-declare your intent. You can't just mutate the binding on a whim.
- Jtsummers 4y agoI'm confused, Scheme also permits mutation of let bindings so Lisp and Scheme do have similar semantics here. Neither language provides immutable (const) let bindings. Scheme just makes it more obvious (by convention) when you may have mutation, through function and form names ending in !.
- dcow 4y agoThe distinction in my mind was that a variable is something where mutation is allowed naturally without being explicit e.g. var a = 1; a = 2. In Scheme you have to opt in to the mutation by using a ! function set! which in scheme's world is like, in C++, const_cast-ing away the const from a pointer, or, in Java, using reflection to make a final field accessible and modify it. All possible using the languages as specified, but semantically not something you're normally encouraged to do.