Closed
Description
This was probably considered, but it might be nice to expose these static methods:
abstract class Record {
static Iterable<Object?> positionalFields(Record record);
static Map<Symbol, Object?> namedFields(Record record);
}
Instead as an extension on the Record class:
extension RecordInfo on Record {
external Iterable<Object?> get positionalFields;
external Map<Symbol, Object?> get namedFields;
}
This would be easier use, myRecord.positionalFields
vs Record.positionalFields(myRecord)
, and it would prevent grabbing a tearoff of these methods.
One bonus of preventing a tearoff is that the compilers should be able to easily know exactly where and how these getters are invoked (and on what record types), and potentially optimize/treeshake better with that knowledge.