Hacker News new | past | comments | ask | show | jobs | submit login

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.




How would you pass an open file by value? What happens when one copy tries to close the file while another still has it open?


Use a handle and pass that by value?


How do you implement a handle if pointers aren't allowed?


Call 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?


So a pointer into the file system?


It’s more like an abstract reference to an opened file.


Use a file descriptor (int)?


Could you explain how functional without side effects helps cache locality?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: