Skip to content

Builtin Map type #17

@mmhat

Description

@mmhat

When working with Dhall every now and then I with for something that is a record, but with a fixed type for all the fields. Records have the advantage that we can address fields by name (record_value.field_name) but we cannot talk about the types of the fields. Lists have the advantage that we can do this - for instance, we can map over the elements - but we cannot address an element in a type-safe way. The idea is to have something combining both, i.e. a homogenous record. But it might be better to call it a Map (or an Object or a Dictionary). Since we have subtyping in this language this type would probably a subtype of Record and can be easily converted to a List.

A first idea for the syntax: {! field1 : value1, field2 : value1, ... }, i.e. the only difference is the exclamation mark after the opening brace (no whitespace allowed inbetween - it parses as one token). This has the disadvantage that it might be easily confused with a record when one is skimming through some source code but on the other hand it one can quickly change a Record type to a Map type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions