You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The support for reflection-ish operations on Record may be expensive:
If a large program uses many records with named fields and contains any invocation of Record.namedFields(r) where the static type of r is dynamic or Record, it will probably be necessary to preserve the names of all named fields in records in the program (as symbols, or possibly strings, cf. #1276).
Similarly, every record would need to have run-time information about the number of positional fields if the program contains an invocation of Record.positionalFields(r), but that's probably not so expensive.
It's easily getting similar to operations that otherwise require 'dart:mirrors'. We might want to leave out those two static methods, or we might provide them in a separate library (say, 'dart:records', maybe as extension getters on Record). However, it looks like this wouldn't be hard to do, because nothing else in the design depends on those methods.
The text was updated successfully, but these errors were encountered:
The support for reflection-ish operations on Record may be expensive:
Yes, I share this concern. I put these into the proposal since other languages seem to support it, but I'm definitely not attached to them.
We could move them to a separate library like you suggest but part of my motivation for making them static methods is that even if they are right in core, we can still statically detect whether they are used.
Cf. https://github.com/dart-lang/language/blob/master/working/0546-patterns/records-feature-specification.md.
The support for reflection-ish operations on
Record
may be expensive:If a large program uses many records with named fields and contains any invocation of
Record.namedFields(r)
where the static type ofr
isdynamic
orRecord
, it will probably be necessary to preserve the names of all named fields in records in the program (as symbols, or possibly strings, cf. #1276).Similarly, every record would need to have run-time information about the number of positional fields if the program contains an invocation of
Record.positionalFields(r)
, but that's probably not so expensive.It's easily getting similar to operations that otherwise require 'dart:mirrors'. We might want to leave out those two static methods, or we might provide them in a separate library (say, 'dart:records', maybe as extension getters on
Record
). However, it looks like this wouldn't be hard to do, because nothing else in the design depends on those methods.The text was updated successfully, but these errors were encountered: