-
Notifications
You must be signed in to change notification settings - Fork 2
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
[RFC] Global relations, input/output relations #12
Comments
Let's not use a word to mean something different. Something 'const' is supposed to never change. |
Sorry, I don't understand what the issue is. I think my definition of |
I think of const relations as the ones that contain just facts. |
Ok, I see now how |
I suggest replacing
The |
I am not sure this syntax is good enough. I think we should write some programs using it and we'll figure out whether it is sufficient. In particular, I am not sure how data will flow in and out of loops. You may want to push the contents of some relations into loops (\delta_0), and to read out the contents of other relations from the loops, which are not part of the fixed-point themselves. |
This is true for all aspects of language design. I am working on a DDlog-1 to DDlog-2 converter, which should provide partial validation for the new design. This is what actually prompted this RFC.
That should "just work". |
I'm not sure how I feel about reusing let like that, maybe |
I think this use of |
Well, if we're limiting As something else to think about, for recursive relations we could take a book from functional languages like F# and require that recursive relations are annotated explicitly with |
The only way to define recursive relations in this language (we don't have the Datalog syntactic sugar yet) is using the fixed_point operator, so not only they are explicitly recursive, but also all mutually recursive relations are declared at the same time:
|
I'd rather |
Hum, thinking about it I think that slight redundancy with requiring let allowed_names: Map<Str, Relation<Str>> = ...;
allowed_names["something"].filter(...); let interesting_numbers: Vec<Relation<usize>> = {
let mut numbers = Vec::new();
numbers.push(primes());
numbers.push(collatz());
numbers
}; let (partitioned_things, partitions) = {
let n = something();
(things.partition(n), n)
} |
Now you're back to using One issue is that there are different kinds of relations (input/output/internal). It's tempting to use different types for them
which is probably too much for most users, so I prefer to have a concrete In addition, input and output relations should have externally visible names or ids, so
is perfectly fine for internal relations, but not for input and output relations. |
Actually, inputs and outputs don't have to be part of the language.
This paves the way for more dynamic APIs that allow modifying the dataflow at runtime, join multiple dataflows, etc. |
We propose to allow
let
-bindings in the global name space. In particular, this will allow writing DDlog-1 style rules whose inputs and outputs have global visibility:Note that such declarations can be considered syntactic sugar for 0-arity functions.
Such relations can also be accessed from a relation transformer without explicitly passing them as an argument to the transformer:
Global mutually recursive relations must be declared as a tuple:
Finally, we can extend this feature to define input and output relations as a special kind of global variables, which seems more ergonomic than passing them as inputs and outputs to the
main
function:The text was updated successfully, but these errors were encountered: