Add a dynamic cast in Typing #223
Labels
Alpha Centauri
The first public alpha release
FTC-Snowcat
Feature: Fully-functional type checker Snowcat
new
New issue to be triaged.
Milestone
There is at least one idiom that cannot be solved by the type system. Sometimes, a function
Int -> Int
can be transformed into a sequence. For instance, here is the piece of code from Queens:The operator
IsSolution
needs a sequence, whereas the operatorSolutions
produces a set of functions from integers to integers. This is not an issue in the untyped semantics of TLA+. However, I do not see a way for a sound transformation of a function into a sequence without an additional test in runtime (e.g., when doing model checking).We should introduce an operator that allows the user to perform such a transformation in "runtime". In this case, the operator would be called like follows:
Both the type checker and type inferer should check, whether the transformation makes sense, e.g.,
Int
should not be transformed intoSet(Int)
. A concrete implementation of the casting will be left to the implementation,e.g., the model checker.
The text was updated successfully, but these errors were encountered: