There's a few small things that the Tutorial doesn't cover. Pre-Declaration is one one them.
As a reminder, the basic syntax is struct Foo:
Rules are:
Foo must be of the same 'kind' when defined. i.e. this doesn't work: struct Foo:, ... union Foo { ... }, because Foo was pre-declared as a struct, but was implemented as a union
Foo must be as generic as it's implementation. i.e. this doesn't work: struct Foo<T>:, ... struct Foo<A B>, because Foo was pre-declared to have one generic parameter, and was implemented with two.
Predeclarations must be resolved, else compiler error
Pre-declarations can be done multiple times if needed in different files.
There's a few small things that the Tutorial doesn't cover. Pre-Declaration is one one them.
As a reminder, the basic syntax is
struct Foo:
Rules are:Foo
must be of the same 'kind' when defined. i.e. this doesn't work:struct Foo:
, ...union Foo { ... }
, becauseFoo
was pre-declared as astruct
, but was implemented as aunion
Foo
must be as generic as it's implementation. i.e. this doesn't work:struct Foo<T>:
, ...struct Foo<A B>
, becauseFoo
was pre-declared to have one generic parameter, and was implemented with two.