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

Add Brioche.get global in std #7

Merged
merged 2 commits into from
May 24, 2024
Merged

Conversation

kylewlacy
Copy link
Member

Companion PR: brioche-dev/brioche#34

This PR updates the std package to define the new global constant Brioche, plus the function Brioche.get(...). This is a special function that works with the Brioche runtime to allow loading an artifact from a local path relative to the current module. It's defined as a global because the runtime needs special awareness of this function.

I tried to make the implementation pretty defensive when setting Brioche.get-- it's only set if it's currently undefined. I figured this might save some headache in the future if we end up in a state where we have multiple versions of std loaded at once (which will probably cause mayhem with this feature). If we want to handle that case, future versions of std can set Brioche.get globally, which will take precedence over this implementation.

@kylewlacy kylewlacy merged commit c4935dd into main May 24, 2024
3 checks passed
@kylewlacy kylewlacy deleted the implement-brioche-get-static-method branch May 24, 2024 10:24
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.

1 participant