Crosscut

Daily Thought - 2024-10-15

Hey, I'm Hanno! These are my daily thoughts on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!

This thought was published before Crosscut was called Crosscut! If it refers to "Caterpillar", that is the old name, just so you know.

< back to list

Let's switch gears and think about maps for a second. It's totally reasonable to store your data in one of those, and just refer to it indirectly, via some kind of handle that is associated with a value in the map. It's also reasonable to expand on that. Create a special map that generates a handle for you when you insert something.

Maybe such a special map could even implement a strategy for managing handles and values. Like making handles unique, and requiring you to return the unique handle to the map when you're done with a value. Or keeping track of which handles exist, and when the last one for a value is dropped, remove that value from the map.

Suddenly, those special maps start to sound like heaps, plus a strategy for managing the memory there. But neither of those would be built into the language. They could very well be implemented in a third-party library. So maybe Caterpillar will have references after all. They might just come in the form of handles into various maps.

<< previous thoughtnext thought >>

Hey, you! Want to subscribe to my daily thoughts? Just let me know (maybe include a nice message, if you're up for it), and I'll send you an email whenever I post a new one.