5 ms·
I'm currently making a language that translates directly to C. There won't be pointers, and I think everything will be passed by value. I'm not sure that comp
by jokoon 4y ago
I'm currently making a language that translates directly to C.
There won't be pointers, and I think everything will be passed by value.
I'm not sure that compilers can optimize this and "move" returned data. But the goal is to greatly limit side effects and improve cache locality by encouraging the coder to use more functional habits instead of oop.
There are grey areas because I'm not sure the design is sound, but even if it's not, it can be safe and fast enough.
- Gigachad 4y agoHow would you pass an open file by value? What happens when one copy tries to close the file while another still has it open?
- starbugs 4y agoUse a handle and pass that by value?
- UncleMeat 4y agoHow do you implement a handle if pointers aren't allowed?
- starbugs 4y agoCall a function that is implemented in C returning you the handle? I didn't say it's a good idea… Isn't that how PHP started off?
- bruce343434 4y agoSo a pointer into the file system?
- starbugs 4y agoIt’s more like an abstract reference to an opened file.
- icedchai 4y agoUse a file descriptor (int)?
- zerodensity 4y agoCould you explain how functional without side effects helps cache locality?