-
Notifications
You must be signed in to change notification settings - Fork 108
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
Record types #245
Comments
Curious. What do you mean by:
isn't this already supported? Also, could you use json objects in place of records? It won't be pretty but I guess it'll have similar semantics. |
My brain cache has been purged, but I think it was something like this:
This gives a syntax error. It would be equivalent to
|
You're right, JSON might work. This works for instance:
And you can effectively name output parameters
which I think checks all my boxes above. If I were to push for having this natively instead of via json, I think the reasons are:
|
There's definitely an overhead of json conversions and it can be error-prone for no real benefit other than syntax niceties. I do second this on second thought, it may make sense that records -> json mapping is easy and simply calling |
Using tuples everywhere relies on positioning to correlate symbols which is risky (mix up the order of two symbols and you can end up with strange results).
Relations kind of support a record syntax, but this isn't supported anywhere else.
I'd like:
?{something: a, something_else: b} := ...
. (Also this would solve the issue that right now there's no way to rename results other than writing a new rule that just forwards the elements with a new name, which is excessive and makes queries more fragile):= my_rule{a: a, b: b}
I assume the framework for this is already there, since results already have headers etc.
And maybe
y = {a: 4, b: something}
get(y, "a")
The text was updated successfully, but these errors were encountered: