This is needlessly obtuse. The definition of the word is that it’s non-constant. There isn’t an ISO definition of the word no, but there are many reputable dictionaries out there that will serve as an alternative.
Except that’s exactly what it is allowed to in algebra.
Sure, in most equations you solve in early algebra school there is only one possible value for the variables. But in many equations there can be multiple, or even infinite. It’s an unknown, and the contents can vary (depending on other constraints, ie. The rest of the equation(s)).
“Variable” refers to the label, i.e. a box that can contain anything (like *ptr is a pointer to [something we dont know anything about])
Immutable describes the contents, i.e. the stuff in the box cant change. (like int* ptr describes that the pointer points to an int)
Rust makes it very obvious that there’s a difference between constants and immutable variables, mainly because constants must be compile time constants.
What do you call it when a variable cant change after its definition, but isnt guaranteed to be the same on each function call? (E.g. x is an array that’s passed in, and we’re just checking if element y exists)
It’s not a constant, the contents of that label are “changing”, but the label’s contents cant be modified inside the scope of that function. So it’s a variable, but immutable.
And more generally mutable aliasing references of any sort are evil. Doesn’t mean they’re not useful, just that you need magic protection spells (mutexes, semaphores, fancy lock-free algorithms, atomics, etc) to use them safely. Skip the spell or use she wrong one, and the demon escapes and destroys all you hold dear.
I additionally mapped that latter one to F2, because being able to repeatedly copy from VIM and paste into another application without having to move your hand between mouse and keyboard is nice.
Of course, that’s VIM. If you meant “vim mode” in shell, then that’s a different story.
Software dev is full of obscure keywords that describe otherwise pretty simple or basic concepts you stumble upon in practice naturally and that you probably already understand.
singleton: a class/object that is designed to be single use, i.e. only ever instantiated with a single instance. Typically used when you use class/objects more for flow control or to represent the state of the program itself, rather than using it to represent data
immutable: read-only, i.e. unchangeable
dependency injection: basically when you pass a function or object into another function object, thereby extending their effective functionality, typically for modular code and to separate concerns.
Here’s one more of my favourite examples of such a keyword: memoization
But we might need to add more features in the future so it might not just be a list in a few years. Better encapsulate it in a few layers of abstractions just to be safe.
I’ve once had a course involving programming and the lecturer rewrote the code, which we were usually using at our institute, making ALL variables global. - Yes, also each and every loop counter and iterator. 🤪
There’s no way you teach a uni course and do this kind of thing unless to demonstrate poor practice/run time difference. Are you sure you were paying attention?
Yes. He really thought it was efficient and would avoid errors if literally all variables were defined in a single Matlab function he called at the beginning of the script. We students all thought: “Man, are you serious?” As we didn’t want to debug such a mess, in our code, we ignored what he was doing and kept using local variables.
Yes, it was a course on finite deformation material models. And no, you do really, really not want to declare each and every variable in your material subroutine globally for the whole finite element program.
That’s why when your job hires new people right out of college they have no idea what they’re doing and now must be trained how to actually do the job. “What, you mean we aren’t writing this enterprise application in python!?”
Any particular reason why you don’t code in Emacs? Since you already set up Org Mode and Org Roam, I’m sure you know how the configuration works and how to write some Elisp. It’s actually not that much work to set up all the things you would need for programming (lsp-mode, etc.)
I guess I just preferred VSCode for coding? Every time I’ve tried to use Emacs for my coding workflows I’ve given up, I think I’m just used to VSCode in that respect. It is weird, I know.
programmer_humor
Active
This magazine is from a federated server and may be incomplete. Browse more on the original instance.