-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
component: compilerConcerning the compilerConcerning the compilercomponent: languageThe Definition of the Plasma LanguageThe Definition of the Plasma Languagemeta: triagedHas the issue been triaged yet?Has the issue been triaged yet?skill: mercurystatus: newA new bug, we may or may not fix it.A new bug, we may or may not fix it.type: enhancement
Milestone
Description
In a dynamic language like Python you can selectively import different modules depending on configuration. We could achieve something a little like that by importing both modules but choosing which symbols to use at runtime with indirect calls. Consider.
func makeTree(xs : List('x)) -> Tree('x) {
var T
if length(xs) < 100 {
T = import BTree
} else {
T = import RBTree
}
var $tree = T.new()
for (x : xs) {
T.insert(x, $tree)
}
return $tree
}
This example assumes some other syntaxes we don't have yet, and the return value isn't well typed. It's more like pseudo code.
At runtime T doesn't actually point to the module, instead T.new and T.insert point to the only two symbols required and the calls are indirect. They may be tupled but to tuple or not-tuple is an optimisation. Both modules need to be present during compilation this is not the same thing as dynamic linking.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
component: compilerConcerning the compilerConcerning the compilercomponent: languageThe Definition of the Plasma LanguageThe Definition of the Plasma Languagemeta: triagedHas the issue been triaged yet?Has the issue been triaged yet?skill: mercurystatus: newA new bug, we may or may not fix it.A new bug, we may or may not fix it.type: enhancement