Live data from Hacker News

Show HN: Micro-mitten – Research language with compile-time memory management

github.com

31–40 of 68 posts

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#31
Discussion on r/ProgrammingLanguages: https://www.reddit.com/r/ProgrammingLanguages/comments/gfgn0...

Discussion on r/rust: https://www.reddit.com/r/rust/comments/gfgt1b/rustlike_langu...

I look at this and I think it's a innovative and promising idea - the freedom of a garbage collected language, but with the tracing done as a type-aware static analysis, and the cleanup code inserted at compile-time!

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#32

Discussion on r/ProgrammingLanguages: https://www.reddit.com/r/ProgrammingLanguages/comments/gfgn0... Discussion on r/rust: https://www.reddit.com/r/rust/comments/gfgt1b/rustlike_langu... I look at this and I think it's a innovative and promising idea - the freedom of a garbage collected language, but with the tracing done as a type-aware static analysis, and the cleanup code inserted at compile-time!

It is not the only one

https://www.csail.mit.edu/event/safe-parallel-programming-pa...

https://chapel-lang.org/docs/master/builtins/OwnedObject.htm...

And a couple more with affine types, or algebraic effects.

Yes, this might be the future, but we are still far from the overall convenience of GC for common programming scenarios.

If anything one was to thank the Rust community for pushing more people to look into this area, regardless of its outcome in the language market.

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#33

Earlier quoted context omitted.

> One thing I'd like to see in modern languages is to encourage and simplify working with an (almost) entirely static memory layout, and make manipulations inside this static memory layout safe. This sounds interesting! What do you mean by (almost) static memory layout? Fixed sizes for everything in a contiguous region, or multiple growing arrays, or something else entirely? In recent time I have written a few progra…

I (mostly) returned to C a little while ago, and for smaller things I sometimes create the entire application state as a single, big struct that's made of many smaller nested structs, maybe with one or very few "layers" of dynamically allocated data dangling off from the static "root structure" (but only when really needed). A very simple example is an all-in-one application data structure like this: https://github.c…

> It's not well suited for bigger programs built from many modules. It should be possible to have highly modular program code, but still end up with a single monolithic "root data layout".

You can still have modules per file, where the globals can be thought as members of a virtual root. And the globals can be either shared or private to the module.

I have seen very complex programs done like that. There are some advantages like proving the program does not run out of memory, but the problem is that you end up with code that is harder to reuse, harder to test, etc. as soon as you start sharing state.

But yeah, it is sometimes done like that.

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#35
post #18
post #14

If a language like this were to take off, I could see linter-style errors pop up that are not currently possible. "ERROR: maximum memory usage computed to be XYZ MB, which is higher than the speicified limit of 500MB" Now that would help keep the RAM bloat down!

As long as it still allows for arbitrary-length vectors - which I can't imagine it not - this would be impossible due to the halting problem. Or I guess, maybe you could derive a lower bound on memory usage, but you could not get an upper bound/exact number.

What about allocation is only possible when you can prove the upper limit. So this is possible

    if (sz (sz)
    else
        throw "Size exceeds upper limit"

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#37
post #18

Earlier quoted context omitted.

As long as it still allows for arbitrary-length vectors - which I can't imagine it not - this would be impossible due to the halting problem. Or I guess, maybe you could derive a lower bound on memory usage, but you could not get an upper bound/exact number.

What about allocation is only possible when you can prove the upper limit. So this is possible if (sz (sz) else throw "Size exceeds upper limit"

I'm saying you could know "it will use at least X memory", but you could never know "it will use at most X memory" unless you seriously cripple the language's capabilities

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#38

I haven't dug into the details a ton, but I am excited to see this! Would love to see more research in this direction. > micro-mitten's approach is significantly different from Rust's. Rather than depending on single ownership and a complex lifetime system, micro-mitten uses a series of data-flow analyses to statically approximate heap liveness. To be clear, Rust these days also looks at control-flow. This was what a…

> And the next generation checker is based on datalog...

Where can I learn more about this?

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#39
post #37

Earlier quoted context omitted.

What about allocation is only possible when you can prove the upper limit. So this is possible if (sz (sz) else throw "Size exceeds upper limit"

I'm saying you could know "it will use at least X memory", but you could never know "it will use at most X memory" unless you seriously cripple the language's capabilities

Maybe there could be a compiler flag. You let any program compile normally, but if you enable the flag, it only allows programs to compile if the maximum memory usage can be computed, and if there are under the limit you specify.

That means the language isn't always crippled, but you can get compiler enforcement for certain embedded programs.

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#40
I'm thinking that until they are perfect these kind of languages lure the developer into a one-way street, convenient until you reach a dead-end at which point your only escape (if you are lucky) is a whole bunch of contrived and difficult to maintain typing constructs.

Still interesting research though.

Post reply on HN