Ticket #122 (new defect)

Opened 2 years ago

Last modified 1 year ago

(Resolved) Compatibility and generics

Reported by: cormac Assigned to: anonymous
Type: defect Priority: trivial
Milestone: M2 Component: Spec
Version: 4 Keywords: lth,brendan,jeffdyer,graydon
Cc:

Description

If Set is a generic interface, should the types

Set.<*> and Set.<int> be compatible?

Attachments

Change History

Changed 2 years ago by lth

My view has been that the type represented by a type application is the parameterized type with the type arguments substituted. This model is simple and intuitive, which is probably its main feature.

A consequence of this is that the rules for type compatibitity follow immediately. If Set is defined as

  type Set.<T> = [T]

then I guess if [*] and [int] are compatible then Set.<*> and Set.<int> are compatible too. Ditto if Set is defined as

  class Set.<T> { ... }

then they would not be compatible (since Set.<int> and Set.<*> are both nominal subclasses of Object, not of Set.<T>).

Changed 2 years ago by cormac

That all makes sense, but in the case where

   class Set.<T> { ... }

we also have the option of saying that Set.<int> and Set.<*> are compatible. This would fit neatly into our framework.

But perhaps we should start with a smaller compatibility relation, and develop a list of potential extensions.

Changed 1 year ago by cormac

Resolved that this notion of compatibility will be supported.

Changed 1 year ago by cormac

  • owner deleted
  • component changed from Proposals to Spec

Changed 1 year ago by graydon

Sorry, resolved that lth's notion of compatibility will be supported, or that your proposed one will be supported? I do not remember the outcome here. I vote with lth on this.

Changed 1 year ago by lth

  • keywords set to lth,brendan,jeffdyer,graydon

Cormac/Graydon, this needs work before the f2f.

Changed 1 year ago by lth

  • priority changed from major to trivial
  • summary changed from compatibility and generics to (Resolved) Compatibility and generics

After some conversation in email (and with Jeff here), we're coming to the conclusion that we do the simple thing for ES4: Set.<int> and Set.<*> are not related. Let's keep it simple for now.

Revisiting this for ES5 seems the right thing.

Changed 1 year ago by lth

It is possible to resolve bugs as "Deferred" in Trac. On the other hand it might be just as useful to keep a more structured document of deferred ideas, to collect what's on the wiki and what's come up over the years.

For the moment I suggest that you open a new bug (because I'd like to keep this until we've started writing) on the issue, then resolve it as deferred, then when we have time we'll go over them and record them properly. I've been doing a lot of writing lately but I doubt I have time for one more paper right now.

Note: See TracTickets for help on using tickets.