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
Crochet separates declarations from expressions to avoid imposing an evaluation order for declarations (and to allow analysis of shapes without security nightmares). However, as currently implemented, declarations are evaluated in the order they appear. This is particularly problematic for types for two reasons:
It makes it harder to properly organise modules, leading to the current 0-types.crochet pattern; but more importantly
It makes it impossible to declare recursive or mutually recursive types, and that makes field contracts often useless. Though this is mitigated by separating cases in a sum type into independent declarations.
Anyway, this should be fixed in the VM so it can conform to the (not yet described) language spec. The simple solution is to allow referring to non-existing definitions with a placeholder, and then replace the placeholder with the correct implementation once we've seen all of its dependencies. We do, however, expect to be able to know some things about the type in several declarations (e.g.: in order to sort commands), so this change has quite some annoying ripple effects.
The text was updated successfully, but these errors were encountered:
Long overdue. This allows types and traits to be defined in any order **within a package** (circular type dependencies will never be allowed outside of a package because Crochet's capabilities require a proper hierarchy of dependencies), and can finally get rid of the awkward `0-types.crochet` convention. Types and traits can now be defined wherever makes most sense for them to be, and circular constraints now work properly.
This fixes#10.
Crochet separates declarations from expressions to avoid imposing an evaluation order for declarations (and to allow analysis of shapes without security nightmares). However, as currently implemented, declarations are evaluated in the order they appear. This is particularly problematic for types for two reasons:
0-types.crochet
pattern; but more importantlyAnyway, this should be fixed in the VM so it can conform to the (not yet described) language spec. The simple solution is to allow referring to non-existing definitions with a placeholder, and then replace the placeholder with the correct implementation once we've seen all of its dependencies. We do, however, expect to be able to know some things about the type in several declarations (e.g.: in order to sort commands), so this change has quite some annoying ripple effects.
The text was updated successfully, but these errors were encountered: