-
Notifications
You must be signed in to change notification settings - Fork 7
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
InterTypes variants referring to locally defined variants #87
Comments
The problem isn't the recursion. The following test case shows recursion support @sum Const begin
ConstStr(val::String)
ConstInt(val::Int32)
ConstBool(val::Bool)
end
@sum Term begin
Constant(val::Const)
Plus(terms::Vector{Term})
IfThenElse(ifcase::Term, thencase::Term, elsecase::Term)
end
struct Assignment
lhs::String
rhs::Term
end The problem is that a sum type variant can't refer to a previous variant. I identified that by deleting parts of the following code until it worked. @sum UWDTerm begin
Statement(relation::Symbol, variables::Vector{Var})
UWDExpr(context::Vector{Var}, statements::Vector{Statement})
UWDModel(header::String, uwd::UWDExpr)
end The problem is that when processing @olynch, this is a pretty big reason for using the @sum Var begin
Untyped(var::Symbol)
Typed(var::Symbol, type::Symbol)
end
struct Statement # <: UWDTerm
relation::Symbol
variables::Vector{Var}
end
struct UWDExpr # <: UWDTerm
context::Vector{Var}
statements::Vector{Statement}
end
struct UWDModel # <: UWDTerm
header::String
uwd::UWDExpr
end |
Sorry for the poor phrasing/characterization. Yes, I made the same replacement with |
It might be useful to be able to define recursive sum types in InterTypes. Currently, the below example is not possible.
The text was updated successfully, but these errors were encountered: