3 ms·
What makes this a "systems programming language", especially since it has "no pointers or references"?
by higherhalf 2y ago
What makes this a "systems programming language", especially since it has "no pointers or references"?
- fc417fc802 2y agoIndeed, that makes it not a systems language by any definition I am familiar with. > Reasonable C interop, and probably, initial compilation to C. How do you achieve "reasonable C interop" without pointers, I wonder?
- apgwoz 2y agoYou cast integers to pointers and play with fire, of course!
- fc417fc802 2y agoVoid*? Int. Char**? Also an Int. I take it back. This is true systems programming - the same type safety that raw assembly is known for.
- pjmlp 2y agoIronically Assembly is safer than C and languages that descend from it, because although CPUs might have undefined behaviour when given undocumented opcodes, or operation modes, the CPU doesn't rewrite your code without telling you about it.
- AnimalMuppet 2y agoThat's "safer" only against a very specific and limited set of dangers. But it opens the door to other dangers.
- fithisux 2y agoYes it is. Great comment.
- pjmlp 2y agoNaturally with PEEK and POKE.
- porridgeraisin 2y agoint ptr
- GoblinSlayer 2y agoThe term was introduced so long ago, it's basically prehistoric now. Pointers are needed only for system programming language, they can be absent in systems programming language.
- DeathArrow 2y agoI wonder the same, but aren't pointers just integers? So if you store a memory address in the integer variable X, you just need a way to access that memory. In assembly languages, usually, you have no pointers.
- tialaramex 2y agoInterestingly although all of C's other types are in fact just the machine integers wearing funny hats (e.g. char is just either a signed or unsigned byte depending on platform, float is just the 32-bit unsigned integers as binary fractions) the pointers are not actually just integers. They could be, but it's much worse from a performance perspective if you just have these raw machine addresses rather than the pointers in the C language so actual C compilers haven't done that for many years. ISO/IEC TS 6010 describes the best current attempt to come up with coherent semantics for these pointers, or here's a Rustier perspective https://www.ralfj.de/blog/2020/12/14/provenance.html https://www.ralfj.de/blog/2020/12/14/provenance.html [today Rust specifically says its pointers have provenance and what that means, like that TS for the C language] Now, if you read Ralf's post and want to argue about that I'm afraid there are already lots of HN discussions and your point has probably already been made so: https://news.ycombinator.com/item?id=25419740 https://news.ycombinator.com/item?id=25419740 or https://news.ycombinator.com/item?id=42878450 https://news.ycombinator.com/item?id=42878450
- SkiFire13 2y ago> float is just the 32-bit unsigned integers as binary fractions Note that float and double are a bit particular because they can use different registers! But yeah, when stored in memory they are the same 32/63 bit integers.
- pjmlp 2y agoLike we did in BASIC, with PEEK and POKE, just have to keep track what those numbers are for.