Skip to content

Should Record wrappers have a null prototype? #71

Closed

Description

  • My issue is not bikeshedding. (we can bikeshed at
    a later proposal stage
    )
  • My issue is not a request to add lots of stuff to
    the semantics. (we can add things in follow-on proposals)
  • My issue is appropriate for a stage 0 proposal and not too
    in-the-weeds.

I have concerns about value types using prototypes. Object.prototype is soo widely used that mutating and adding properties to it is virtually impossible without Symbols I feel like the same would become true for Record quickly. Likewise, adding methods to Array is very fraught with compatibility problems and have similar concerns for Tuple. Do we have reasons that we want property delegation to occur on the value itself vs something like using static methods instead? Is the usage of mutable prototypes intended to be for consistency or some other reason?

Could prototypes be added later if desired? It seems mutable prototypes goes against some of the intentions of immutable structures as properties on the prototype could be added or removed at runtime thereby affecting things like record.isSafe from const record = {| foo: 1 |} by the prototype delegation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions