Skip to content

Add getMap and getList back to Std.Table (safely) #51

@jparoz

Description

@jparoz

With the trivial implementation, there's nothing to stop a user producing incorrectly typed values in Huck like so:

goodList = Std.List.collect [123];
goodMap = Std.Map.collect [(2, "two")];
badMap = getMap $ mkTable goodList goodMap;

This produces a Lua table like

badMap = {123, "two"}

which is interpreted in Huck as

badMap : Std.Map.Map Int String;

but the element at key 1 has the wrong type of value!

Need a solution in order to put these functions back in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions