Skip to content

Design Meeting Notes, 11/20/2015Β #5740

Closed
@RyanCavanaugh

Description

@RyanCavanaugh
  • Walkthrough of JSX SFCs and IntrinsicAttributes
  • Walkthrough of Salsa JS Class inference
  • Type inference for intersection/union types
    • πŸ‘
  • Grand unified theory of enums
    • Clear your mind and let's go on a journey of imagination 🌈 ⭐
    • Imagine a "string enum" enum Direction { North = 'north', South = 'south', ...}
    • type NS = Direction.North|Direction.South
    • What does this declaration actually mean?
      • It produces the following declarations
        • namespace Direction {
        • const North = "north" <- const North: North or const North: Direction ?
        • type North = "north"
        • }
        • type Direction = Direction.North | Direction.South | ...
      • It's not just contextual typing that needs to apply here
        • But we could tweak the rules
      • What should the assignability of strings to string literal types be?
    • This logic applies equally well to numbers!
    • How would we enforce enum branding in this scheme for numeric enums?
      • Add the ability to create 'fresh' types
      • A general solution for many problems
      • We could also enforce structural matching of the names
    • What about symbols?
      • Still no clear approach to handling symbol identity
    • Other primitive types are coming
      • Mostly numbers (UInt64, rational, bignum, struct, vector, etc...)
    • What should we inline?
      • Maybe const x = 10 ? With an opt-in
    • Mutable vs immutable widening, e.g.
      • let x = Direction.North; // x: Direction
      • const x = Direction.North; // x: Direction.North
      • What are the effects in e.g. function f() { let/const x = Direction.North; return x; } ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design NotesNotes from our design meetings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions