4 ms·
In Haskell: Variables? What state? Everything is puuuuuuuuure. In Python: Everything is an object (numbers, true/false values, strings, etc), some are mutabl
by wting 14y ago
In Haskell:
Variables? What state? Everything is puuuuuuuuure.
In Python:
Everything is an object (numbers, true/false values, strings, etc), some are mutable and some are not. Variables are temporary labels on objects (think of them as hard links).
In Rust/C++:
There are various types of boxes / smart pointers (shared, unique, heap, etc), and unsafe / raw pointers should be avoided when possible.
In C:
Not every variable has a data type, e.g. void or function pointers.
- _kst_ 14y ago"Not every variable has a data type, e.g. void or function pointers." A void pointer has type "void* "; a function pointer also has some appropriate type. Not every object has a type (e.g., a chunk of memory allocated by `malloc()`), but if "variable" means "object created by a declaration", then yes, every object has a type.