5 ms·
If you want to understand this article you'll need to learn a programming language like C. Once you know what the stack, the heap, and records/fields are you'll
by firethief 7y ago
If you want to understand this article you'll need to learn a programming language like C. Once you know what the stack, the heap, and records/fields are you'll be able to ask meaningful questions.
- morelisp 7y agoIt's weird to see a recommendation to learn C when 'scubbo's questions already indicate some knowledge of memory management - far more than you will learn "learning C". The suggestion to "allocate memory progresively" and not-necessarily-contiguously resembles Lisp cons cells, and the questions about how to handle conflicts are the first steps to inventing (and then finding the downsides of) https://en.wikipedia.org/wiki/CDR_coding https://en.wikipedia.org/wiki/CDR_coding. The second question is also reasonable, "a value for a base class" is somewhat ambiguous - if I read the post right it means specifying a value for the derived class's inherited fields by using an instance of the base class without copying, but in languages with more dynamic approaches to dispatch it would also be reasonable to talk about reassigning the base class itself (e.g. MRO tricks in Python). And "such piece-wise allocation" is indeed possible in various Lisp-inspired object systems.
- scubbo 7y ago> scubbo's questions already indicate some knowledge of memory management I'm flattered! But no - I have a math degree, and the Java and Python that I'm familiar with are strictly high-level and self-taught from six years in industry * . I can give you an idea of my lack of knowledge of actual low-level details by saying that I know that the heap and the stack are different concepts in memory, but not how they differ in structure or use. Thanks for the link to CDR Coding - I'll work my way through that, and hopefully it will spur a lot more puzzled questions that I can then Google to continue educating myself! * plus I worked my way through Seven Languages in Seven Weeks a few months back, so I can fumble my way through understanding a Lisp (Clojure, if I recall correctly)
- firethief 7y agoIt does sound like they know something of a lisp-like programming model, but in C none of that is applicable because structs have fields at fixed offsets. In spite of lisp's obvious superiority, I think it could be useful to learn how the unenlightened languages people actually use do this stuff.