Description
Consider the following code:
tbl = table: name
row: "Rob"
end
tbl.row("Foo")
When I execute without type checker all is well.
With type checker, .row
is not found.
I did quite a bit of digging and printing and I noticed that the fields on the Table
data-type obeject resulting from instantiate-data-type(obj-type, context)
were surprisingly limited:
t-data(Table, [list: ], [list: ], [string-dict: length, ( -> Number)], builtin(dummy location))
I expect many more methods than just this on Table
. Eventually I landed on the global provides and noticed this:
"Table": ["data", "Table", [], [], {
"length": ["arrow", [], "Number"]
}],
I reproduced locally by modifying tests/type-check/good/table.arr
, then added the type signature for row
to the global provides and it passed the type checker.
I noticed String-Dict
and Reactor
both "provide" their own data-types. Should Table
do the same?
60 seconds of ctrl-f made me realize just moving the data-type from global provides to table provides isn't as simple as it might seem... it seems it will require resolving some dependency/module loading. Wanted to confirm the desired behavior before venturing further :)