Introduce a new keyword extension with the intention of allowing arbitrary modifiers to be used alongside the keyword. In practice, extensions either loads an extension similar to extensions or allows for a url modifier, which is only supported in NetLogo Web.
New extension keyword is dubbed ConfigurableExtensions
Implementation Details
In Galapagos the tortoise.coffee file contains functions to compile NLogo and NLogoX files. Before compilation, and after rewrites, we extract the code from the .nlogo[x] file.The call stack from there is:
1.Galapagos:NLWExtensionsLoader.loadURLExtensions
2. which calls org.nlogo.tortoise:BroswerCompiler.listExtensions
3. which calls org.nlogo.core:FrontEnd.findAllExtensions
4. which calls org.nlogo.parse:StructureParser.findExtensions and org.nlogo.parse:StructureParser.findConfigurableExtensions
5. which tokenizes the code and extracts the extension list
The extension list is returned to Galapagos:NLWExtensionsLoader.loadURLExtensions which figures out the extension module URL and primitives JSON url by changing .js at the end of the URL to .json and creates a lazy loader for the module as well as fetching the primitives JSON and caching it in window.URLExtensionsRepo.
Galapagos:NLWExtensionsLoader.getPrimitivesFromURL is exposed to org.nlogo.tortoise using scala.js, which uses it to get primitives if extURL is defined in org.nlogo.tortoise:NLWExtensionsManager.importExtension.
Current Work
NetLogo
Add new syntax and parser results to NetLogo.
Add methods in FrontEnd: findConfigurableExtensions and findAllExtensions
Add syntax, parser, and front-end tests.
Update ExtensionManager to support URL as a parameters (this throws on Desktop)
Tortoise
Add a new BrowserCompiler.listExtensions(source: String) that delegates to FrontEnd.findAllExtensions and returns a JSON [{ name: String, url: String?}].
Implement new ExtensionManager for NLWExtensionManager.
Galapagos
Add NLWExtensionsLoader to load URL extensions before compilation
Integrate NLWExtensionsLoader to the compilation function for .nlogox files.
omargfh
changed the title
Configurable Extensions for NetLogo; URL Extensions for NetLogo Web
[NetLogo/Tortoise/Galapagos] Configurable Extensions for NetLogo; URL Extensions for NetLogo Web #434
Jul 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[WIP] [NetLogo/Tortoise/Galapagos] Configurable Extensions for NetLogo; URL Extensions for NetLogo Web
Branches
Specification
Implementation Details
1.Galapagos:NLWExtensionsLoader.loadURLExtensions
2. which calls org.nlogo.tortoise:BroswerCompiler.listExtensions
3. which calls org.nlogo.core:FrontEnd.findAllExtensions
4. which calls org.nlogo.parse:StructureParser.findExtensions and org.nlogo.parse:StructureParser.findConfigurableExtensions
5. which tokenizes the code and extracts the extension list
Current Work
NetLogo
Tortoise
Galapagos