26 points bobbydigitales 1 hour ago 13 comments

MiroslavPokorny 42 minutes ago | parent

What does Goose change about memory management ?

kenferry 24 minutes ago | parent

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.

backlands 31 minutes ago | parent

> Goose looks familiar like C or Rust, and is built on one idea: there is no heap

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:

> - Nothing ever moves

> - ... A string, an array of strings, a record with variable-size fields and an array of those records are each one contiguous block with no pointer in it

I'll have to look a bit deeper to decide if it's feasible to write many things in this language.

bobbydigitales 15 minutes ago | parent

What kinds of things do you think might not translate well?

tombert 12 minutes ago | parent

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.

skew-aberration 10 minutes ago | parent

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

skew-aberration 11 minutes ago | parent

You could write everything if you refactor to continuation passing style

dadoum 29 minutes ago | parent

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.

finn888 8 minutes ago | parent

Faster than C++ is always a head-turner. Curious what "magic" enables that with memory safety.