Skip to content

RAII-V3 - automated resource management#689

Open
renehiemstra wants to merge 30 commits intoterralang:masterfrom
renehiemstra:raii-v3-refac
Open

RAII-V3 - automated resource management#689
renehiemstra wants to merge 30 commits intoterralang:masterfrom
renehiemstra:raii-v3-refac

Conversation

@renehiemstra
Copy link
Copy Markdown
Contributor

I've closed RAII-V2 and reopened it here to put forward the finalized design.

Traditionally, Terra has only supported manual, C-style resource management. While functional, this approach limits the full potential of Terra’s powerful metaprogramming capabilities. To address this limitation, the contribution introduces automated resource management based on RAII. This enables the implementation of smart containers and smart pointers, like std::string, std::vector and std::unique_ptr, std::shared_ptr in C++.

The design does not introduce any breaking changes. No new keywords are introduced. Heap resources are acquired and released using the regular C stdlib functions such malloc and free, leaving memory allocation in the hands of the programmer.

The documented design can be found here.

renehiemstra and others added 27 commits June 11, 2025 11:44
…ion and added to relevant cmake files for installation
…nted out to get access to the C-libs but the macos13 and macos14 images in the CI require it. We need to look into this.
* remove offset_ptr from descriptions

* add comment to raii docs about changing this pointer

* readd tests/raii-offset_ptr.t with clearer content
…f overloads corresponding to 'to' and 'from'. 'overload(to)' should come first.
…nd __move respectively. Also disabled custom __move.
…alize types that have no implementation of __dtor. This is useful for types that require initialization but do not cary a resource.
Copy link
Copy Markdown
Member

@elliottslaughter elliottslaughter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review on the design document only. Will start to look at the code next.

…cope rather then after the variable decleration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants