- 351comments
- 71comments
- 150comments
- 16comments
- 136comments
- 48comments
- 196comments
- 2comments
- 4comments
- 34comments
- 19comments
- —discuss
- 118comments
- 38comments
- 23comments
- 17comments
- 34comments
- 309comments
- 106comments
- 55comments
- 180comments
- 34comments
- 339comments
- —discuss
- 4comments
- 25comments
- 19comments
- 101comments
- 48comments
- 2comments
What does Goose change about memory management ?
A lot - title could probably use editing. The language has no heap, only stack memory, so the only deallocation is returning from a call stack frame.
How big is the stack? Too often large data will blow the top and destroy adjacent stacks in multi-thread environments. Are memory barrier fences used to check against overflow?
If I am reading it correctly, the compiler creates N bump allocators per function - where N is (I'm guessing at this point) determined by liveness or similar.
So it looks like it restricts the memory management to 100% scope based. I expect that makes a lot of designs for programs not translate to it as well as they fit in Rust or Java (for example). There are a bunch more constraining design choices they list further down:
I'll have to look a bit deeper to decide if it's feasible to write many things in this language.
What kinds of things do you think might not translate well?
Not the OP, but I'm thinking about like closures?
Say you wanted to make a Node.js framework with callbacks that react to an event. The callback might be a closure that captured some of its surrounding variables. At that point, any of the captured variables are not trivially stack-allocated.
You might be able to do something similar to what Rust does with moving though.
You could predefine your event handlers within your context, then call 'enter framework' and pass your event handlers as arguments. this is continuation passing style
You could write everything if you refactor to continuation passing style
I am researching a similar idea but which allowed moves if the compiler was able to fix the resulting structure, but mine will probably stay a small side project for a long time.
Faster than C++ is always a head-turner. Curious what "magic" enables that with memory safety.
Usually strict aliasing.
So much Claude text. I'm sure this is great (I did a bunch of stuff with/to aardappel's lobster, years ago, and it was pretty tidy, and quite easy to work with), but: Claude's writing makes my brain melt.
It's a no from me. I'm sorry.
I'm always fuzzy on this, so 116% faster or 16% faster? The benchmarks suggest 16%.
116% would be 2x which will break the laws of physics. 16% is possible if you're not allocating heap memory, which I believe is the main selling point here.
Evergreen: https://randomascii.wordpress.com/2018/02/04/what-we-talk-ab...
(Feels like it should probably say "1.16x as fast" or "1.16x the throughput" - or something like that.)