Skip to content

feat(runtime): Refactor/Re-organize runtime/dataStructures#2391

Open
spotandjake wants to merge 4 commits intograin-lang:oscar/gc-rebasedfrom
spotandjake:spotandjake/runtime-refactor
Open

feat(runtime): Refactor/Re-organize runtime/dataStructures#2391
spotandjake wants to merge 4 commits intograin-lang:oscar/gc-rebasedfrom
spotandjake:spotandjake/runtime-refactor

Conversation

@spotandjake
Copy link
Copy Markdown
Member

This pr cleans up our data structure module in the runtime. The main goal of this pr was to improve type safety and make the api more intuitive.

Changes:

  • Each data structure now has its own submodule.
  • I've added new String.StringRef abstract types
    • I've added some ref types, which are just abstract types wrapping WasmRef, the benefit of this is that it makes some of the reference types incompatible, which helps to prevent applying the wrong function. This has only been done for types that can be concretely typed currently; however, we may want to consider applying this to the number subtypes and eventually ADTs and Records.
  • Move runtime/dataStructure and runtime/debugPrint into runtime/unsafe.
    • This change was made as both of these are really only used in unsafe contexts it seems like a better home
  • Merge conv into dataStructures.
    • Previously, you had to use a mix of both modules depending on what you wanted to do, which often led to people duplicating the logic from conv throughout the stdlib and runtime, this pr eliminates the conv library, making those functions easier to find when you're working with the low-level data structures already.

While working on this pr the better type safety actually revealed an issue in wasi/findPath where we were grabbing the wrong value.

Closes: #2157

This work is based on: #2378

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.

1 participant