Bubbler-4 / TryInBrowser

Online interpreter that works even if you go offline
https://try-in-browser.netlify.app/
MIT License
4 stars 0 forks source link

Make Language struct to only add languages in one place #9

Closed ysthakur closed 3 years ago

ysthakur commented 3 years ago

Somewhat messy, but this allows you to only add a language in one place in lang/mod.rs. However, since it uses a global immutable variable, you can't add the example language based on the config. I think that's alright, though. I'm also not sure if the functions need to be references or not, or if Language should be a trait so that dyn Language can be used.

netlify[bot] commented 3 years ago

✔️ Deploy Preview for try-in-browser ready!

🔨 Explore the source changes: 59f538e8598929b140ffd6c2ae2db9a396e659de

🔍 Inspect the deploy log: https://app.netlify.com/sites/try-in-browser/deploys/61130359dd5ee700076a9d45

😎 Browse the preview: https://deploy-preview-9--try-in-browser.netlify.app

Bubbler-4 commented 3 years ago

I managed to do this myself, without sacrificing any of &dyn avoiding, conditional ExampleLang, etc.