On 26 January 2018 at 14:20, Michael Morris <tendo...@gmail.com> wrote:
> On Thu, Jan 25, 2018 at 11:59 PM, Niklas Keller <m...@kelunik.com> wrote: > >> >> $b instanceof SomeClass<string> > >> >> > >> >> Returns true if SomeClass can be iterated and contains only strings. > >> >> > >> > > >> > This would block generics with that syntax then. > >> > > >> > >> I don't understand this comment. > >> > > > > You restrict these type parameters to iterators, but generics are useful > > in a lot more places. > > > > iterABLE --- not iterATOR. Two different things. > > [...] > > The similarity of the names is regrettable, but it's already in place and > can't be changed at this point. > I think you misunderstood Niklas's point. Your example showed the syntax "SomeClass<string>" with an iterator/iterable specific meaning, which would mean we couldn't later use this syntax for generics. With generics, "$b instanceof SomeClass<string>" would mean "is the class of $b, or one of its parents or interfaces, a generic template SomeClass<T> specialised on the type string"; that would be incompatible with your proposed meaning of "$b can be iterated and contains only strings". The plain form "iterable<string>" would co-exist fine with generics, and "Iterator<string>" could be kept compatible if a generic interface "Iterator<T>" was added when generics came along, so we wouldn't be tying our hands by adding those. Regards, -- Rowan Collins [IMSoP]