Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 11, 2007 Re: Using typedefed types as covariant return types | ||||
---|---|---|---|---|
| ||||
Bill Baxter Wrote: > What are you reading that makes you think CFStringRef is "derived" from CFTypeRef? It seems to be implied by the "Implicit Conversions" section of <http://www.digitalmars.com/d/type.html>: "A typedef or enum can be implicitly converted to its base type, but going the other way requires an explicit conversion. " |
February 12, 2007 Re: Using typedefed types as covariant return types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rick Mann | Rick Mann wrote: > Bill Baxter Wrote: > >> What are you reading that makes you think CFStringRef is "derived" from CFTypeRef? > > It seems to be implied by the "Implicit Conversions" section of <http://www.digitalmars.com/d/type.html>: > > "A typedef or enum can be implicitly converted to its base type, but going the other way requires an explicit conversion. " Implicitly convertible doesn't mean a type is a subtype of another. Altough in this case of typedef and enums I think they could be subtypes of the base type. -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D |
February 12, 2007 Re: Using typedefed types as covariant return types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bruno Medeiros | Bruno Medeiros wrote:
> Rick Mann wrote:
>> Bill Baxter Wrote:
>> "A typedef or enum can be implicitly converted to its base type, but going the other way requires an explicit conversion. "
>
> Implicitly convertible doesn't mean a type is a subtype of another. Altough in this case of typedef and enums I think they could be subtypes of the base type.
Perhaps he meant the "to its base type" part? I could see someone mixing that up with the same term used in class hierarchies...
|
February 12, 2007 Re: Using typedefed types as covariant return types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frits van Bommel | Frits van Bommel wrote: > Bruno Medeiros wrote: >> Rick Mann wrote: >>> Bill Baxter Wrote: >>> "A typedef or enum can be implicitly converted to its base type, but going the other way requires an explicit conversion. " >> >> Implicitly convertible doesn't mean a type is a subtype of another. Altough in this case of typedef and enums I think they could be subtypes of the base type. > > Perhaps he meant the "to its base type" part? I could see someone mixing that up with the same term used in class hierarchies... True enough, that may cause some confusion. -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D |
February 17, 2007 Re: Using typedefed types as covariant return types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frits van Bommel | Frits van Bommel Wrote:
> Bruno Medeiros wrote:
> > Rick Mann wrote:
> >> Bill Baxter Wrote:
> >> "A typedef or enum can be implicitly converted to its base type, but
> >> going the other way requires an explicit conversion. "
> >
> > Implicitly convertible doesn't mean a type is a subtype of another. Altough in this case of typedef and enums I think they could be subtypes of the base type.
>
> Perhaps he meant the "to its base type" part? I could see someone mixing that up with the same term used in class hierarchies...
In that case, I'd like to make it a feature request. It seems only natural to be able to use typedefs in this manner. Should I file a formal request via bug?
|
Copyright © 1999-2021 by the D Language Foundation