Open saraswat opened 4 years ago
Object
is a special ADT which is introduced in one of the phases (I think TypeEncoding
) to encode the hierarchy of types.
We have two ways of generating verification conditions, one with --type-checker
(default) which for now disallows non strictly positive datatypes (see for instance : http://vilhelms.github.io/posts/why-must-inductive-types-be-strictly-positive/). The older verification condition generation with --type-checker=false
allows those, but may suffer from soundness issues.
For now the "complex" types introduced by the TypeEncoding
phase are not well supported by the default --type-checker
option.
(I am not yet sure this will end up being a Feature Request or a Bug Report and/or Documentation. But hopefully discussion of this will make its way into a Stainless primer on converting code...)
Background: Crucial to using a sophisticated language like Scala is understanding the type system and what you can get it to do for you idiomatically.
I am beginning to get a sense for how the Stainless design deals with Scala's type system (see various issues related to recursive types, existential types, type variable declarations .. note again that the issues are being driven from practical consdierations in trying to port a significant Java code base to Stainless, not from a language-level analysis).
Q: Is Stainless designed to support Scala's co- and contra-variance declarations?
Turns out that the following code "works" (i.e. Stainless compiles and terminates, without throwing a traceback or any other sign of discomfort).
This is great! Plan to use it. Are there any cautionary tales around co/contravariance that the designers / implementers of Stainless can think of that should be kept in mind by the programmer?
This brings up a related point: Is contra variance actually usable meaningfully in Stainless (for user-defined classes). My attempt at using it (schematically -- this is not motivated from real code I am working on) resulted in a surprising (new)) error.
Code:
Error:
So a few questions:
ADT Object
andObject
mean?Thanks!!