Skip to content

Enhancing CMakePPLang with Frozen Maps / Objects #94

Description

@Xyphenore

Great job on this project! I've been searching for something like this to enhance my CMake scripts and incorporate a map container. It's unfortunate that your work hasn't gained enough popularity yet.

Problem description
In Python, there is often a need to create immutable maps and lists that prevent the addition or removal of values. I use maps to store constants such as file hashes, which should remain unchanged during execution. However, currently, I am able to modify the map containing file hashes. I would like the map to be constant, similar to how it behaves in C++.

Requested solution
I suggest adding a member function to freeze an object, specifically a map. When an object is frozen, the 'set' function should throw an exception and prevent any modifications to the object.

Considered alternatives
One alternative I've considered is using a keyword in the constructor to directly create a frozen map without the need for a separate 'freeze' function.

Note: Please ensure that the implementation also accounts for thawing or unfreezing an object if needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions