Add `module` block to SDL
See original GitHub issueThe current version of SDL and migrations does not allow expressing the migration of interdependent modules because a single SDL blob is only supposed to reference one module. The solution to this is to force SDL to express the entire user-schema in the context of migration. This means that a single SDL block must denote unambiguously which modules the various entities belong to. There are two mechanisms proposed for that:
- Fully-qualified names for all entities (except ones belonging to
std
, since that’s always built-in in all contexts). - A special
module <name> { ... }
block. All inner SDL inside this block is understood to have the default module<name>
. It is possible to have multiplemodule
blocks with the same name in a single SDL document.
The total list of modules in the schema is inferred from module
block names and from fully-qualified names.
Example of SDL using module blocks:
module default {
# the default module here is "default"
type Foo {
# the module "std" is also part of the default name
# resolution as usual
property name -> str;
link bar -> other_mod::Bar;
}
}
module other_mod {
# the default module here is "other_mod"
type Bar {
link bar -> Bar;
link foo -> default::Foo;
}
}
And the same schema expressed using only fully-qualified names SDL:
# only the "std" module can be omitted here, all other
# names have to be fully-qualified, even "defaut"
type default::Foo {
property name -> str;
link bar -> other_mod::Bar;
}
type other_mod::Bar {
link bar -> other_mod::Bar;
link foo -> default::Foo;
}
The following schemas are also equivalent:
# Multiple module blocks with the same name
module default {
type Foo;
}
module other_mod {
type Bar;
}
module default {
type Foo2;
}
# Each module block has a unique name
module default {
type Foo;
type Foo2;
}
module other_mod {
type Bar;
}
# Mix of fully-qualified names and module blocks
type default::Foo;
module other_mod {
type Bar;
}
module default {
type Foo2;
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (19 by maintainers)
Top Results From Across the Web
Modules — SDL | EdgeDB Docs
The module block declaration defines a new module similar to the create module command, but it also allows putting the module content as...
Read more >Exercise: Convert your data map to SDL - Apollo GraphQL
Goal: Convert the data map you created earlier into SDL. (Don't worry about mutations for now.) Create types Track , Author , and...
Read more >SDL2/MigrationGuide - SDL Wiki
Now you can create an SDL_Surface that is always in RAM instead of using the one you would have gotten from SDL_SetVideoMode() ,...
Read more >Understanding C++ Modules: Part 3: Linkage and Fragments
In the above example, add , sub , and get_value all have external linkage, and counter has module linkage. There is no way...
Read more >SDL library in C/C++ with examples - GeeksforGeeks
Run command sudo apt-get install libsdl2-2.0-0 libsdl2-dbg libsdl2-dev libsdl2-image-2.0-0 libsdl2-image-dbg libsdl2-image-dev on your terminal.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The options 1 and 2 are mutually exclusive, meaning:
<module>::<shortname>
) can only be used in a declaration that is not nested in anymodule
block. It is also a requirement to use fully-qualified name in this case.module
block, only short names are allowed.This is legal:
This is not legal:
The new SDL syntax has been implemented.