4 ms·
While I'm reading about limbo and occam, what do you think apl and oberon can express that C cannot ? talking about low level electronics benefits (apl array id
by agumonkey 3y ago
While I'm reading about limbo and occam, what do you think apl and oberon can express that C cannot ? talking about low level electronics benefits (apl array idioms are superb for sure)
- pjmlp 3y agoBounds checking by default. Actors, more precisely active objects in Active Oberon, the only one still actively being developed at ETHZ from Oberon linage.
- lelanthran 3y ago>> what do you think apl and oberon can express that C cannot ? > Bounds checking by default. That's odd - I've written a C container library that checks bounds by default. Are you sure that C doesn't allow you to check bounds?
- pjmlp 3y agoAbsolutely unless you're using a compiler with language extensions for pointer management. A library isn't the language that is described by the ISO C standard document.
- lelanthran 3y ago> A library isn't the language that is described by the ISO C standard document. Sure, but the poster didn't ask "what comes with apl and oberon that doesn't come with C", they asked "what do you think apl and oberon can express that C cannot?" And you absolutely, positively can EXPRESS bounds checking in C. I'm not sure where you heard that this is impossible, but it's probable you misunderstood or that source is wrong.
- pjmlp 3y agoFirst of all your library doesn't come with C, otherwise it would be defined on the PDF I can buy from ISO. Secondly using if statements and conditional expressions isn't what bounds checking in a programing language is about. Here is some education material, https://en.wikipedia.org/wiki/Bounds_checking https://en.wikipedia.org/wiki/Bounds_checking > Many programming languages, such as C, never perform automatic bounds checking to raise speed. However, this leaves many off-by-one errors and buffer overflows uncaught. Many programmers believe these languages sacrifice too much for rapid execution.[1] In his 1980 Turing Award lecture, C. A. R. Hoare described his experience in the design of ALGOL 60, a language that included bounds checking, saying: Feel free to update the Wikipedia page and convince Wikipedia of your reasoning.
- lelanthran 3y agoWhat does any of that have to do with whether or not you can EXPRESS bounds checking in a C program? You were misinformed; one can certainly express bounds checking in a C program, independent of libraries or compiler extensions.
- pjmlp 3y agoPlease educate us, we are all curious to learn how. Only the ISO C language is allowed, declare C array and then show us how do you validate the accesses with the index operator. As second exercise, show us how a function call using pointer + length, validates that the lengh into the pointer region is a valid length for the memory region total size.
- agumonkey 3y agoslightly branching out, I wonder if recent languages like zig allow (or will) customized array language features. They seem to more flexible about compiletime vs runtime and also allocation mechanisms
- lelanthran 3y ago> Only the ISO C language is allowed, declare C array and then show us how do you validate the accesses with the index operator. Who said anything about arrays? Let me refresh what was said, and what you claimed. What was said: > what do you think apl and oberon can express that C cannot ? What you claimed > Bounds checking by default. Are you seriously saying that you did not claim that bounds checking cannot be expressed in C? Because that is all this boils down to - my reading of that was that you claimed that bounds checking is an example of a thing that "apl and oberon can express that C cannot ? " > Only the ISO C language is allowed, declare C array and then show us how do you validate the accesses with the index operator. No one made this claim so there is no point in doing what you asked. > As second exercise, show us how a function call using pointer + length, validates that the lengh into the pointer region is a valid length for the memory region total size. No one claimed this either. The specific claim is that it is possible to express bounds checking in C.
- agumonkey 3y agoHmm good question, but i think my question is located half way. What you describe is basically turing completeness, C allow to write more on top, but it won't be integrated in the base constructs of the language. I admit that this comment too is fuzzy :) I hope things don't go angry in here
- deleted 3y ago[deleted]
- agumonkey 3y agobut that's a high level feature, when people talk about C not being a low level language they mean you can't control/reflect the hardware enough right ? or maybe I'm misguided
- lproven 3y agoI recommend Sophie Wilson's talk on CPU architectures for some interesting insight into this. https://www.youtube.com/watch?v=6lOnpQgn-9s https://www.youtube.com/watch?v=6lOnpQgn-9s It's worth the time, IMHO, and I dislike video presentations. This one is different. She designed the ARM processor (and BBC BASIC before that).