3 ms·
Semantics. You can call Fil-C’s pointers whatever you like. You can call them capabilities if that works better for you. The point of my post is to enumerate
by pizlonator 2y ago
Semantics.
You can call Fil-C’s pointers whatever you like. You can call them capabilities if that works better for you.
The point of my post is to enumerate the set of things you’d need to do to pointers to make them safe. If that then means we’ve created something that you wouldn’t call a pointer then like whatever
- tredre3 2y ago> Semantics. If your goal is just to redefine the word then by all means, continue. But semantics are very important if your goal is to drive adoption of your ideas. You can't misuse a term and then get pissy when people don't understand you.
- pizlonator 2y agoSeems like bro understood me just fine. In Fil-C, pointers are called “pointers”.
- PaulDavisThe1st 2y agoAnd my point is that you cannot make C pointers safe. You can make something else that is safe, and you're clearly hard at work on that, which is great.
- pizlonator 2y agoFil-C's pointers work more like C pointers than like any other language construct I can think of, and are compatible enough that lots of C/C++ code compiles and runs with no changes. So I think that Fil-C pointers are just pointers. You could even get pedantic over what the spec says. If you go there, you find that Fil-C's pointers work exactly like how the spec promises pointers to work (and all of the places that the spec doesn't define either have safe semantics in Fil-C or lead to Fil-C safety errors).
- pjc50 2y agoWhat behavior in the C standard requires unsafety from pointers??
- pizlonator 2y agoNot a big fan of this line of thinking since if you tried to deploy a C implementation that just implements what's in the C standard, then you'd quickly find that real world C code expects more of pointers than the C standard promises. Fil-C supports a superset of the C standard but a subset of what contemporary mainstream C compilers support (you can't pass an integer around in memory that is really being used to represent a pointer in Fil-C, but you can in Yolo-C).
- layer8 2y agoDoes Fil-C support uintptr_t? Because I’ve written programs that I believe to be quite strictly conforming C99 programs, that make use of uintptr_t.
- pizlonator 2y agoYes you can use uintptr_t. You just can’t cast a pointer to uintptr_t, then store that int into memory, then load it back, then cast it back to pointer, and then dereference that pointer.
- layer8 2y agoOkay, but the C standard does allow exactly that for void*.
- pizlonator 2y agoYou can do exactly that with `void*` in Fil-C. I just don’t let integer types carry capabilities. If I did, things would get weird (like if you said `x + y` and both happened to carry capabilities then what would you get?)