AdeptLanguage / Adept

The Adept Programming Language
GNU General Public License v3.0
119 stars 9 forks source link

Should Adept have a GC? #279

Closed ghost closed 8 months ago

ghost commented 8 months ago

I don't want to turn Adept into another Go though. The GC should be completely optional. Please have a look at how Modula-3 did it:

https://github.com/modula3/cm3

IsaacShelton commented 8 months ago

I was thinking of maybe resorting to a GC, however finalizers are still problematic. Optional GC gets the worst of both worlds, so it would probably be light GC with opt-out areas or an alternative memory management.

ghost commented 7 months ago

I was thinking of maybe resorting to a GC, however finalizers are still problematic. Optional GC gets the worst of both worlds, so it would probably be light GC with opt-out areas or an alternative memory management.

Is manual memory management still available?

ghost commented 7 months ago

I was thinking of maybe resorting to a GC, however finalizers are still problematic. Optional GC gets the worst of both worlds, so it would probably be light GC with opt-out areas or an alternative memory management.

Btw, did you really have a look at Modula-3? I spent a whole night reading the documentation. Even though it's several decades older than Go, Modula-3 is very similar to Go. Modula-3 is generally a safe language like Go, defaulting to GC, but also support unsafe module. The GC on Modula-3 is module level. It's not very different from Go's unsafe package, but more elegant since it's built-in into the language.

IsaacShelton commented 7 months ago

I was thinking of maybe resorting to a GC, however finalizers are still problematic. Optional GC gets the worst of both worlds, so it would probably be light GC with opt-out areas or an alternative memory management.

Is manual memory management still available?

Yes manual memory management will still be available.

I'm still designing the memory management system, but manual memory management is guaranteed to be supported.

I was thinking of maybe resorting to a GC, however finalizers are still problematic. Optional GC gets the worst of both worlds, so it would probably be light GC with opt-out areas or an alternative memory management.

Btw, did you really have a look at Modula-3? I spent a whole night reading the documentation. Even though it's several decades older than Go, Modula-3 is very similar to Go. Modula-3 is generally a safe language like Go, defaulting to GC, but also support unsafe module. The GC on Modula-3 is module level. It's not very different from Go's unsafe package, but more elegant since it's built-in into the language.

I did manage to find the unsafe part of the documentation for Modula 3, and I do like that idea of having higher-level granularity over unsafe/safe code as opposed to only having unsafe functions/blocks. Unsafeness seems to come together as modules so something like this would seem very natural.

The specifics are not set in stone yet, but increased safety and runtime guarantees are high on the list so this will definitely be something to consider in the list of features to be included.