177 points · by bshanks · 8y ago · 35 comments
[1] http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/m...
Meaning the REPL, dynamic code reloading, debugger, ...
Then we had to wait a couple of decades to catch up and aren't still not there.
Hang on! Do you mean some similarity other than what is talked about in the article?
https://en.wikipedia.org/wiki/Memory_model_(programming)
Regardless, interesting to read about "old" languages, such as Cobol. The way data was laid out in Cobol programs made sense with old computing resource limitations.
The use of "memory model" to describe primarily threading/concurrency behavior seems to be a Java innovation that's been picked up by the Go community.
"² I’m calling these six conceptualizations “memory models”, even though that term used to mean a specific thing that is related to 8086 addressing modes in C but not really related to this. (I’d love to have a better term for this.)"
I think that's even more wrong. The Wikipedia article gives a pretty good idea what the term means.
I think a good term for what he's talking about is "data [structure] memory layout".
The 8086 thing was legitimately called a memory model, choosing how the distinction between the 64k segments would be treated logically by your program. https://en.wikipedia.org/wiki/Intel_Memory_Model
I'd categorize the popular ones like this:
- One sparse byte array: C, C++
- GC heap with class instances with fields: Java, C#, etc.
- Affine structs and enums on the stack, plus library support for heap and other models: Rust
- Dictionaries and primitives: JavaScript, Python, Ruby, etc.
- Immutable structs and enums on the heap: (safe) Haskell
- Textual/array/dictionary variables, global and local: bash and other shells
What does sparse mean in this context?
There's a way in which C# is Java done right. Go can be seen as Java done right, for a different definition of "right". On paper they are virtually identical languages. In practice they are quite different.
Can you explain this? In what sense is Go "Java done right"? The OPs comment isnt offering me much insight into your comment. Thanks.
[1] https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Hea...
[2] http://www.mosaic-industries.com/embedded-systems/legacy-pro...
I'm thinking of a DSL on top of a pure associative memory, which will remember Things with weighted connections to other Things. Matching consists of not only showing the idea but also related ones more distant. Is there anything like this?
Lua doesn't get quite the cred it should, in the language wars. Its one of those "just going under the radar, getting things done" languages..
EDIT: like, isn't everything a finite map eventually, or at least partially expressible, idktb......
Then LISP models evolved to still use cons cells, but there now are a bunch of primitive objects (which were not introduced by Java, but existed in LISP long before) like certain numbers and characters. LISP then also did not organize everything as atomic symbol. Atoms were not symbols and a bunch of other data types. For example numbers were no longer (pseudo) atomic symbols. There are atoms, but atom then only meant: all data types which are not cons cells. Where originally there were only cons cells and atomic symbols.
LISP tries to avoid to store pointers to primitive numbers/characters and can store them directly. Most objects are tagged and tags for primitive types are stored without added words. Thus a cons cell with two numbers can be two words and each word is some primitive number. The implementation may also avoid to tag cons cells. Instead the pointer to a cons cell will be tagged. Similar is true for vectors. vectors also may not only be vectors of pointers, but can store primitive objects directly and may be optimized for some primitive objects: for example a vector of bits is just a vector header and a one dimensional packed array of bits. The header can't be avoided, but the bits will be stored directly and not as array of pointers to bits. Some objects may be allocated on the stack or in registers - for example primitive numbers may exist multiple times in memory - but other data objects may only exist once - like a string, which is a vector of characters.
So for primitive data types (some numbers, characters, ...) LISP tries to avoid pointers to them, makes them as small as possible, has the tags integrated into the word representation (thus on a 64bit machine typically a fixnum integer will not be able to use all 64 bits, because the tags need to be represented) and integrates the bits in such a way that they can be efficiently set and checked, possibly even by processor instructions - like on a SPARC processor which has 'some' primitive support for that.
Other types of things in memory then are symbols, functions (also machine coded functions) and record-like objects: structures and instances of classes. Those records usually will use a vector to store their slots. Even more data types exist with a low-level representation like hashtables and multi-dimensional arrays. The organization of these objects in memory can be relatively simple (one big pool) or complex (multiple type sorted pools with generations).
I meant:
Atoms were now symbols and a bunch of other data types.