Skip to content

[Records] Should records have an asMap method? #2673

Closed
@leafpetersen

Description

@leafpetersen

In discussion , @rakudrama suggested the possibility of specifying that records provide an asMap method, producing either a Map<String, Object?> or perhaps a Map<Object, Object?> if we prefer to use integers to index the positional fields.

This would make writing generic code over records feasible in more places, e.g. we could make the toString method on records be a method on Record which used the asMap method + iteration.

We could also consider providing an asList method which provided an integer indexed view (perhaps using a canonical order for the named parameters, or else just providing a view on the positional fields).

cc @lrhn @munificent @eernstg @jakemac53 @natebosch @stereotype441 @kallentu @mit-mit

Metadata

Metadata

Assignees

Labels

recordsIssues related to records.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions