Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stdlib): Add Exception.toString #2143

Merged
merged 7 commits into from
Sep 22, 2024

Conversation

spotandjake
Copy link
Member

This pr adds Exception.toString to the Exception module closing #1334

Implementation notes, I decided to rework the way we handle exception printers, moving panic into its own module in runtime/unsafe and removing exception as a dependecy of gc and malloc. This allows us to use Exception in a regular mode and avoid a lot of the memory leaks we had before. This also allows us to address the AssertionError comment in the Exception file because we can allocate strings safely now.

If we are not happy with this implementation I am happy to go back to how we handled things before and implement Exception.toString the way we did it before.

@ospencer
Copy link
Member

I'm not against reworking the libraries in this way, but it borders on being a breaking change. It's only not technically breaking because there isn't a way to catch exceptions. I'd be more comfortable releasing this in a breaking release.

stdlib/runtime/unsafe/panic.gr Outdated Show resolved Hide resolved
stdlib/exception.gr Outdated Show resolved Hide resolved
stdlib/exception.gr Outdated Show resolved Hide resolved
@spotandjake spotandjake force-pushed the spotandjake-exception-tostring branch from f4260bf to 0008e64 Compare August 31, 2024 18:26
stdlib/exception.gr Outdated Show resolved Hide resolved
stdlib/runtime/exception.gr Outdated Show resolved Hide resolved
stdlib/runtime/gc.gr Outdated Show resolved Hide resolved
@spotandjake
Copy link
Member Author

Made those changes

@ospencer
Copy link
Member

Looks like you need to update the smallest program test.

@spotandjake
Copy link
Member Author

Fixed

@ospencer ospencer added this pull request to the merge queue Sep 22, 2024
Merged via the queue into grain-lang:main with commit 0894dc5 Sep 22, 2024
12 checks passed
@github-actions github-actions bot mentioned this pull request Sep 22, 2024
@spotandjake spotandjake mentioned this pull request Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants