-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
I tried to specify a struct name as a field type:
ketos=> (struct foo ((a string)))
foo
ketos=> (struct bar ((b foo)))
bar
ketos=> (new bar :b (new foo :a "fails"))
Traceback:
In main, lambda
In system function new
execution error: type error for field `b` of struct `bar`: expected foo; found struct: foo { a: "fails" }
ketos=> (struct baz ((b struct)))
baz
ketos=> (new baz :b (new foo :a "works"))
baz { b: foo { a: "works" } }
The error confused me for a while until I realized the type for all struct values is "struct". Could it allow you to specify a struct type for a field?
Also, the definition for bar was accepted, even though there is no such type foo - every attempt to create a bar will fail to typecheck!
wackbyte
Metadata
Metadata
Assignees
Labels
No labels