You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a request for an extension to the domain permutation functionality.
When permuting a domain, I would like to be able to narrow a type (with-exclude or with-include) differently depending on where I'm using it in my AST definition (domain). Currently I can narrow a sum-type's variants only at the global/top level. This prevents me from re-using sum-types in another domain in those cases where I want to allow distinct subset of variants in different places (variants) of my own.
Below is a little cooked up example of what I'd like to be able to do:
(define common_ops_ast
(domain
(sum core_expr
(op_a param::symbol)
(op_b param::symbol)
(op_c param::symbol))
) // end domain
) // end define
(define reuse_ops_ast
(permute common_ops_ast
(with_alias core_expr_ops_ab
(with core_expr // <------------+-- 'with-alias' allows re-import
(exclude op_c))) // | of the same domain sum-types with
(with_alias core_expr_ops_bc // | separate (narrowed) permutation
(with core_expr // <------------+ of variants
(exclude op_a)))
(sum node1
(op1 expr::core_expr_ops_ab)) // <-- accepts only op_a & op_b from core_expr
(sum node2
(op2 expr::core_expr_ops_bc)) / <-- accepts only op_b & op_c from core_expr
) // end permute
) // end define
My motivation is specific to PartiQL and its AST; the partiql_ast domain currently has an expr sum-type that includes a ton of useful and handy "operators"/variant which I would like to re-use. I would like to re-use them because I do not want to diverge from the expressions in the expr of partiql_ast. I would like to narrow them as much as possible early on (and relax them later) because I want the PIRG domain I create (by permuting partiql_ast) to present to readers exactly what my backend is capable of (as opposed to me throwing run-time errors when I get something from expr that I haven't implemented or haven't figure out if I want to support).
Thanks,
Chuck
The text was updated successfully, but these errors were encountered:
This is a request for an extension to the domain permutation functionality.
When permuting a domain, I would like to be able to narrow a type (with-exclude or with-include) differently depending on where I'm using it in my AST definition (domain). Currently I can narrow a sum-type's variants only at the global/top level. This prevents me from re-using sum-types in another domain in those cases where I want to allow distinct subset of variants in different places (variants) of my own.
Below is a little cooked up example of what I'd like to be able to do:
My motivation is specific to PartiQL and its AST; the
partiql_ast
domain currently has anexpr
sum-type that includes a ton of useful and handy "operators"/variant which I would like to re-use. I would like to re-use them because I do not want to diverge from the expressions in theexpr
ofpartiql_ast
. I would like to narrow them as much as possible early on (and relax them later) because I want the PIRG domain I create (by permutingpartiql_ast
) to present to readers exactly what my backend is capable of (as opposed to me throwing run-time errors when I get something fromexpr
that I haven't implemented or haven't figure out if I want to support).Thanks,
Chuck
The text was updated successfully, but these errors were encountered: