public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* glossary for egcs - request for contributions
@ 1999-04-27 15:24 Philipp Thomas
  1999-04-27 22:16 ` Jeffrey A Law
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Philipp Thomas @ 1999-04-27 15:24 UTC (permalink / raw)
  To: egcs

[Gavin Romig-Koch <gavin@cygnus.com> suggested to post the request here, so
here it goes]

While doing the german translation of egcs messages I had problems
understanding the messages in the first place. 

So it occurred to me that there should be some kind of document helping the
'decoding' of egcs and the documentation. Gavin suggested that it would be
best to add a glossary to the egcs documentation. As this again is task where
I'm able to contribute, I've taken it up to start such a beast.

As I quite possibly will miss some terms as they're too familiar to me, I'd
like to ask that anybody who thinks he has (or had) problems with the terms
used in egcs (both messages and documentation) send me these terms for
inclusion.


Philipp Thomas

-- 
caffeine low .... brain halted

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-27 15:24 glossary for egcs - request for contributions Philipp Thomas
@ 1999-04-27 22:16 ` Jeffrey A Law
  1999-04-28 10:01   ` Theodore Papadopoulo
  1999-04-30 23:15   ` Jeffrey A Law
  1999-04-27 23:35 ` Martin v. Loewis
  1999-04-30 23:15 ` Philipp Thomas
  2 siblings, 2 replies; 24+ messages in thread
From: Jeffrey A Law @ 1999-04-27 22:16 UTC (permalink / raw)
  To: Philipp Thomas; +Cc: egcs

  In message < 3735364e.75002974@mailer.gwdg.de >you write:
  > So it occurred to me that there should be some kind of document helping the
  > 'decoding' of egcs and the documentation. Gavin suggested that it would be
  > best to add a glossary to the egcs documentation. As this again is task where
  > I'm able to contribute, I've taken it up to start such a beast.
I thought someone had already started a glossary of terms or something like
that...   Though I got the impression it was mostly for terms we tend to use
on the list like LICM, PRE, LCM, CFG, etc etc.

I'm not sure what ever happened to that list, but having it online would be
a good idea :-)

jeff

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-27 15:24 glossary for egcs - request for contributions Philipp Thomas
  1999-04-27 22:16 ` Jeffrey A Law
@ 1999-04-27 23:35 ` Martin v. Loewis
  1999-04-28  0:08   ` Joe Buck
  1999-04-30 23:15   ` Martin v. Loewis
  1999-04-30 23:15 ` Philipp Thomas
  2 siblings, 2 replies; 24+ messages in thread
From: Martin v. Loewis @ 1999-04-27 23:35 UTC (permalink / raw)
  To: kthomas; +Cc: egcs

> As I quite possibly will miss some terms as they're too familiar to me, I'd
> like to ask that anybody who thinks he has (or had) problems with the terms
> used in egcs (both messages and documentation) send me these terms for
> inclusion.

For C++, 'covariant return types', and 'contravariance violation' are
probably most frequently confusing.

Regards,
Martin

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-27 23:35 ` Martin v. Loewis
@ 1999-04-28  0:08   ` Joe Buck
  1999-04-28  9:46     ` Marc Espie
  1999-04-30 23:15     ` Joe Buck
  1999-04-30 23:15   ` Martin v. Loewis
  1 sibling, 2 replies; 24+ messages in thread
From: Joe Buck @ 1999-04-28  0:08 UTC (permalink / raw)
  To: Martin v. Loewis; +Cc: kthomas, egcs

> > As I quite possibly will miss some terms as they're too familiar to me, I'd
> > like to ask that anybody who thinks he has (or had) problems with the terms
> > used in egcs (both messages and documentation) send me these terms for
> > inclusion.
> 
> For C++, 'covariant return types', and 'contravariance violation' are
> probably most frequently confusing.

I can't think of any explanation for these errors that doesn't require at
least a paragraph.  Maybe we should add a URL or reference to a node in
gcc.info, or both, to the error message, since it seems that when people
encounter them they immediately post to gnu.g++.help or egcs.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-28  0:08   ` Joe Buck
@ 1999-04-28  9:46     ` Marc Espie
  1999-04-28 23:48       ` Joe Buck
  1999-04-30 23:15       ` Marc Espie
  1999-04-30 23:15     ` Joe Buck
  1 sibling, 2 replies; 24+ messages in thread
From: Marc Espie @ 1999-04-28  9:46 UTC (permalink / raw)
  To: jbuck; +Cc: egcs

In article < 199904280705.AAA04952@atrus.synopsys.com > you write:
>> > As I quite possibly will miss some terms as they're too familiar to me, I'd
>> > like to ask that anybody who thinks he has (or had) problems with the terms
>> > used in egcs (both messages and documentation) send me these terms for
>> > inclusion.
>> 
>> For C++, 'covariant return types', and 'contravariance violation' are
>> probably most frequently confusing.

>I can't think of any explanation for these errors that doesn't require at
>least a paragraph.  Maybe we should add a URL or reference to a node in
>gcc.info, or both, to the error message, since it seems that when people
>encounter them they immediately post to gnu.g++.help or egcs.

Is there any online paper that clearly explains, in understandable words,
what covariant/contravariant means in an object type theory ?

I have read several books on the subject, but I wouldn't recommend them to
someone who would just like to know what's going on.

On the other hand, I believe that, to understand what these error messages
means, one usually has to have at least an intuitive grasp of what these
concepts are... without a conceptual model, one is going to lose, sooner or
later.  Getting past the compiler,  but writing hierarchies in which lists of
triangles inherit from lists of shapes, or some other classical mistake.

What I mean is, if we want to put an explanation for that one in, it had
better cover the problem fairly, not give the casual reader a superficial
understanding of what's going on.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-27 22:16 ` Jeffrey A Law
@ 1999-04-28 10:01   ` Theodore Papadopoulo
  1999-04-30 23:15     ` Theodore Papadopoulo
  1999-04-30 23:15   ` Jeffrey A Law
  1 sibling, 1 reply; 24+ messages in thread
From: Theodore Papadopoulo @ 1999-04-28 10:01 UTC (permalink / raw)
  To: law; +Cc: Philipp Thomas, egcs

>   In message < 3735364e.75002974@mailer.gwdg.de >you write:
>   > So it occurred to me that there should be some kind of document helping the
>   > 'decoding' of egcs and the documentation. Gavin suggested that it would be
>   > best to add a glossary to the egcs documentation. As this again is task where
>   > I'm able to contribute, I've taken it up to start such a beast.
> I thought someone had already started a glossary of terms or something like
> that...   Though I got the impression it was mostly for terms we tend to use
> on the list like LICM, PRE, LCM, CFG, etc etc.
> 
> I'm not sure what ever happened to that list, but having it online would be
> a good idea :-)

	I think I'm the responsible for suggesting that and promised 
to try to gather sthg... Unfortunately, I have not gone very far up 
to now (but I'm still willing to do sthg about it). I do not have 
much time currently but will definitely try to contribute one in a 
(close?) future. What would be the proper format however ? texi or 
html. Having it online would certainly be great... Having it in the 
manual would be great too... This applies as well to Philipp's 
proposal AFAICT.

However, I believe that what Philipp suggested however is a little 
different in that he is targetting more gcc's users than developper's
(well beginners in gcc development :-) ). Maybe two different sections
(web pages) ?

	Theo.

--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
 --------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-28  9:46     ` Marc Espie
@ 1999-04-28 23:48       ` Joe Buck
  1999-04-29  0:12         ` Alexandre Oliva
                           ` (2 more replies)
  1999-04-30 23:15       ` Marc Espie
  1 sibling, 3 replies; 24+ messages in thread
From: Joe Buck @ 1999-04-28 23:48 UTC (permalink / raw)
  To: Marc Espie; +Cc: jbuck, egcs

> >> For C++, 'covariant return types', and 'contravariance violation' are
> >> probably most frequently confusing.
> 
> >I can't think of any explanation for these errors that doesn't require at
> >least a paragraph.  Maybe we should add a URL or reference to a node in
> >gcc.info, or both, to the error message, since it seems that when people
> >encounter them they immediately post to gnu.g++.help or egcs.
> 
> Is there any online paper that clearly explains, in understandable words,
> what covariant/contravariant means in an object type theory ?

No, we'd have to write a note.  Let me know if you think the following is
intuitive.  I'm just dashing it off so there may be syntax errors.  Note
that I'm using the C++ terms (base class, derived class) not the typical
terms from type theory (subclass/superclass).

covariant: varying in the same way as.  If a language feature is covariant
one may replace a class by a derived class.  e.g. I can overload a virtual
function 
	Base* Base::clone() const { return new Base(*this);}
with
	Derived* Derived::clone() const { return new Derived(*this);}

return types are covariant: when the class changes from Base to Derived,
the return type changes in the same way.

contravariant: varying in the opposite way as.  If a language feature is
contravariant, one may replace a class by a class that it is derived
from.

Function arguments, for pointers to functions, are contravariant.
If I have
	typedef int (*PFBase)(Base&);

naive users think that

	int dfunc(Derived&);
	PFBase p = &dfunc;

should be legal, since they are used to convariance.  But this is broken,
since if it were legal I could pass a Base object to dfunc.  Instead,
if I have

	typedef int (*PFDerived)(Derived&);
	int bfunc(Base&);
	PFDerived p = &bfunc;

this is legal: I replaced a more derived by a less derived class.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-28 23:48       ` Joe Buck
@ 1999-04-29  0:12         ` Alexandre Oliva
  1999-04-29  3:26           ` Joe Buck
  1999-04-30 23:15           ` Alexandre Oliva
  1999-04-29  0:21         ` Jason Merrill
  1999-04-30 23:15         ` Joe Buck
  2 siblings, 2 replies; 24+ messages in thread
From: Alexandre Oliva @ 1999-04-29  0:12 UTC (permalink / raw)
  To: Joe Buck; +Cc: Marc Espie, egcs

On Apr 29, 1999, Joe Buck <jbuck@Synopsys.COM> wrote:

> one may replace a class by a derived class.  e.g. I can overload a virtual
                                                              ^^^^
make that override

> 	typedef int (*PFDerived)(Derived&);
> 	int bfunc(Base&);
> 	PFDerived p = &bfunc;

> this is legal

No way!  :-)

You can't touch types of arguments when casting function types.  This
mechanism only works for pointers-to-members:

struct Base { void foo(); };
struct Derived : Base {};
typedef void (Derived::*PFDerived)();
PFDerived pD = &Base::foo;

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-28 23:48       ` Joe Buck
  1999-04-29  0:12         ` Alexandre Oliva
@ 1999-04-29  0:21         ` Jason Merrill
  1999-04-30 23:15           ` Jason Merrill
  1999-04-30 23:15         ` Joe Buck
  2 siblings, 1 reply; 24+ messages in thread
From: Jason Merrill @ 1999-04-29  0:21 UTC (permalink / raw)
  To: Joe Buck; +Cc: Marc Espie, egcs

>>>>> Joe Buck <jbuck@Synopsys.COM> writes:

 > Function arguments, for pointers to functions, are contravariant.

Actually, function arguments are invariant as far as C++ is concerned;
there are no implicit conversions between function pointer types.  g++
used to treat them as contravariant, but I think I tore out that code a
while back.

Jason

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-29  0:12         ` Alexandre Oliva
@ 1999-04-29  3:26           ` Joe Buck
  1999-04-29  3:41             ` Alexandre Oliva
                               ` (2 more replies)
  1999-04-30 23:15           ` Alexandre Oliva
  1 sibling, 3 replies; 24+ messages in thread
From: Joe Buck @ 1999-04-29  3:26 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: jbuck, espie, egcs

> > one may replace a class by a derived class.  e.g. I can overload a virtual
>                                                               ^^^^
> make that override
> 
> > 	typedef int (*PFDerived)(Derived&);
> > 	int bfunc(Base&);
> > 	PFDerived p = &bfunc;
> 
> > this is legal
> 
> No way!  :-)

Alexandre is right, I was wrong, the C++ language is wrong.  (That is,
they should have permitted contravariance for regular function pointers,
not just member function pointers).

> You can't touch types of arguments when casting function types.  This
> mechanism only works for pointers-to-members:
> 
> struct Base { void foo(); };
> struct Derived : Base {};
> typedef void (Derived::*PFDerived)();
> PFDerived pD = &Base::foo;

Correct.  Let's pretend I wrote that. :-)

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-29  3:26           ` Joe Buck
@ 1999-04-29  3:41             ` Alexandre Oliva
  1999-04-30 23:15               ` Alexandre Oliva
  1999-04-29 21:44             ` Jason Merrill
  1999-04-30 23:15             ` Joe Buck
  2 siblings, 1 reply; 24+ messages in thread
From: Alexandre Oliva @ 1999-04-29  3:41 UTC (permalink / raw)
  To: Joe Buck; +Cc: espie, egcs

On Apr 29, 1999, Joe Buck <jbuck@Synopsys.COM> wrote:

> Correct.  Let's pretend I wrote that. :-)

Sure!  It's copyleft :-)

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-29  3:26           ` Joe Buck
  1999-04-29  3:41             ` Alexandre Oliva
@ 1999-04-29 21:44             ` Jason Merrill
  1999-04-30 23:15               ` Jason Merrill
  1999-04-30 23:15             ` Joe Buck
  2 siblings, 1 reply; 24+ messages in thread
From: Jason Merrill @ 1999-04-29 21:44 UTC (permalink / raw)
  To: Joe Buck; +Cc: Alexandre Oliva, espie, egcs

>>>>> Joe Buck <jbuck@Synopsys.COM> writes:

 >> > 	typedef int (*PFDerived)(Derived&);
 >> > 	int bfunc(Base&);
 >> > 	PFDerived p = &bfunc;
 >> 
 >> > this is legal
 >> 
 >> No way!  :-)

 > Alexandre is right, I was wrong, the C++ language is wrong.  (That is,
 > they should have permitted contravariance for regular function pointers,
 > not just member function pointers).

But then how would you deal with MI?  It works for PMFs because they aren't
just pointers.

Jason

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-27 22:16 ` Jeffrey A Law
  1999-04-28 10:01   ` Theodore Papadopoulo
@ 1999-04-30 23:15   ` Jeffrey A Law
  1 sibling, 0 replies; 24+ messages in thread
From: Jeffrey A Law @ 1999-04-30 23:15 UTC (permalink / raw)
  To: Philipp Thomas; +Cc: egcs

  In message < 3735364e.75002974@mailer.gwdg.de >you write:
  > So it occurred to me that there should be some kind of document helping the
  > 'decoding' of egcs and the documentation. Gavin suggested that it would be
  > best to add a glossary to the egcs documentation. As this again is task where
  > I'm able to contribute, I've taken it up to start such a beast.
I thought someone had already started a glossary of terms or something like
that...   Though I got the impression it was mostly for terms we tend to use
on the list like LICM, PRE, LCM, CFG, etc etc.

I'm not sure what ever happened to that list, but having it online would be
a good idea :-)

jeff

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-28 10:01   ` Theodore Papadopoulo
@ 1999-04-30 23:15     ` Theodore Papadopoulo
  0 siblings, 0 replies; 24+ messages in thread
From: Theodore Papadopoulo @ 1999-04-30 23:15 UTC (permalink / raw)
  To: law; +Cc: Philipp Thomas, egcs

>   In message < 3735364e.75002974@mailer.gwdg.de >you write:
>   > So it occurred to me that there should be some kind of document helping the
>   > 'decoding' of egcs and the documentation. Gavin suggested that it would be
>   > best to add a glossary to the egcs documentation. As this again is task where
>   > I'm able to contribute, I've taken it up to start such a beast.
> I thought someone had already started a glossary of terms or something like
> that...   Though I got the impression it was mostly for terms we tend to use
> on the list like LICM, PRE, LCM, CFG, etc etc.
> 
> I'm not sure what ever happened to that list, but having it online would be
> a good idea :-)

	I think I'm the responsible for suggesting that and promised 
to try to gather sthg... Unfortunately, I have not gone very far up 
to now (but I'm still willing to do sthg about it). I do not have 
much time currently but will definitely try to contribute one in a 
(close?) future. What would be the proper format however ? texi or 
html. Having it online would certainly be great... Having it in the 
manual would be great too... This applies as well to Philipp's 
proposal AFAICT.

However, I believe that what Philipp suggested however is a little 
different in that he is targetting more gcc's users than developper's
(well beginners in gcc development :-) ). Maybe two different sections
(web pages) ?

	Theo.

--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
 --------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-29  0:21         ` Jason Merrill
@ 1999-04-30 23:15           ` Jason Merrill
  0 siblings, 0 replies; 24+ messages in thread
From: Jason Merrill @ 1999-04-30 23:15 UTC (permalink / raw)
  To: Joe Buck; +Cc: Marc Espie, egcs

>>>>> Joe Buck <jbuck@Synopsys.COM> writes:

 > Function arguments, for pointers to functions, are contravariant.

Actually, function arguments are invariant as far as C++ is concerned;
there are no implicit conversions between function pointer types.  g++
used to treat them as contravariant, but I think I tore out that code a
while back.

Jason

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-28  0:08   ` Joe Buck
  1999-04-28  9:46     ` Marc Espie
@ 1999-04-30 23:15     ` Joe Buck
  1 sibling, 0 replies; 24+ messages in thread
From: Joe Buck @ 1999-04-30 23:15 UTC (permalink / raw)
  To: Martin v. Loewis; +Cc: kthomas, egcs

> > As I quite possibly will miss some terms as they're too familiar to me, I'd
> > like to ask that anybody who thinks he has (or had) problems with the terms
> > used in egcs (both messages and documentation) send me these terms for
> > inclusion.
> 
> For C++, 'covariant return types', and 'contravariance violation' are
> probably most frequently confusing.

I can't think of any explanation for these errors that doesn't require at
least a paragraph.  Maybe we should add a URL or reference to a node in
gcc.info, or both, to the error message, since it seems that when people
encounter them they immediately post to gnu.g++.help or egcs.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-29 21:44             ` Jason Merrill
@ 1999-04-30 23:15               ` Jason Merrill
  0 siblings, 0 replies; 24+ messages in thread
From: Jason Merrill @ 1999-04-30 23:15 UTC (permalink / raw)
  To: Joe Buck; +Cc: Alexandre Oliva, espie, egcs

>>>>> Joe Buck <jbuck@Synopsys.COM> writes:

 >> > 	typedef int (*PFDerived)(Derived&);
 >> > 	int bfunc(Base&);
 >> > 	PFDerived p = &bfunc;
 >> 
 >> > this is legal
 >> 
 >> No way!  :-)

 > Alexandre is right, I was wrong, the C++ language is wrong.  (That is,
 > they should have permitted contravariance for regular function pointers,
 > not just member function pointers).

But then how would you deal with MI?  It works for PMFs because they aren't
just pointers.

Jason

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-28 23:48       ` Joe Buck
  1999-04-29  0:12         ` Alexandre Oliva
  1999-04-29  0:21         ` Jason Merrill
@ 1999-04-30 23:15         ` Joe Buck
  2 siblings, 0 replies; 24+ messages in thread
From: Joe Buck @ 1999-04-30 23:15 UTC (permalink / raw)
  To: Marc Espie; +Cc: jbuck, egcs

> >> For C++, 'covariant return types', and 'contravariance violation' are
> >> probably most frequently confusing.
> 
> >I can't think of any explanation for these errors that doesn't require at
> >least a paragraph.  Maybe we should add a URL or reference to a node in
> >gcc.info, or both, to the error message, since it seems that when people
> >encounter them they immediately post to gnu.g++.help or egcs.
> 
> Is there any online paper that clearly explains, in understandable words,
> what covariant/contravariant means in an object type theory ?

No, we'd have to write a note.  Let me know if you think the following is
intuitive.  I'm just dashing it off so there may be syntax errors.  Note
that I'm using the C++ terms (base class, derived class) not the typical
terms from type theory (subclass/superclass).

covariant: varying in the same way as.  If a language feature is covariant
one may replace a class by a derived class.  e.g. I can overload a virtual
function 
	Base* Base::clone() const { return new Base(*this);}
with
	Derived* Derived::clone() const { return new Derived(*this);}

return types are covariant: when the class changes from Base to Derived,
the return type changes in the same way.

contravariant: varying in the opposite way as.  If a language feature is
contravariant, one may replace a class by a class that it is derived
from.

Function arguments, for pointers to functions, are contravariant.
If I have
	typedef int (*PFBase)(Base&);

naive users think that

	int dfunc(Derived&);
	PFBase p = &dfunc;

should be legal, since they are used to convariance.  But this is broken,
since if it were legal I could pass a Base object to dfunc.  Instead,
if I have

	typedef int (*PFDerived)(Derived&);
	int bfunc(Base&);
	PFDerived p = &bfunc;

this is legal: I replaced a more derived by a less derived class.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-28  9:46     ` Marc Espie
  1999-04-28 23:48       ` Joe Buck
@ 1999-04-30 23:15       ` Marc Espie
  1 sibling, 0 replies; 24+ messages in thread
From: Marc Espie @ 1999-04-30 23:15 UTC (permalink / raw)
  To: jbuck; +Cc: egcs

In article < 199904280705.AAA04952@atrus.synopsys.com > you write:
>> > As I quite possibly will miss some terms as they're too familiar to me, I'd
>> > like to ask that anybody who thinks he has (or had) problems with the terms
>> > used in egcs (both messages and documentation) send me these terms for
>> > inclusion.
>> 
>> For C++, 'covariant return types', and 'contravariance violation' are
>> probably most frequently confusing.

>I can't think of any explanation for these errors that doesn't require at
>least a paragraph.  Maybe we should add a URL or reference to a node in
>gcc.info, or both, to the error message, since it seems that when people
>encounter them they immediately post to gnu.g++.help or egcs.

Is there any online paper that clearly explains, in understandable words,
what covariant/contravariant means in an object type theory ?

I have read several books on the subject, but I wouldn't recommend them to
someone who would just like to know what's going on.

On the other hand, I believe that, to understand what these error messages
means, one usually has to have at least an intuitive grasp of what these
concepts are... without a conceptual model, one is going to lose, sooner or
later.  Getting past the compiler,  but writing hierarchies in which lists of
triangles inherit from lists of shapes, or some other classical mistake.

What I mean is, if we want to put an explanation for that one in, it had
better cover the problem fairly, not give the casual reader a superficial
understanding of what's going on.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* glossary for egcs - request for contributions
  1999-04-27 15:24 glossary for egcs - request for contributions Philipp Thomas
  1999-04-27 22:16 ` Jeffrey A Law
  1999-04-27 23:35 ` Martin v. Loewis
@ 1999-04-30 23:15 ` Philipp Thomas
  2 siblings, 0 replies; 24+ messages in thread
From: Philipp Thomas @ 1999-04-30 23:15 UTC (permalink / raw)
  To: egcs

[Gavin Romig-Koch <gavin@cygnus.com> suggested to post the request here, so
here it goes]

While doing the german translation of egcs messages I had problems
understanding the messages in the first place. 

So it occurred to me that there should be some kind of document helping the
'decoding' of egcs and the documentation. Gavin suggested that it would be
best to add a glossary to the egcs documentation. As this again is task where
I'm able to contribute, I've taken it up to start such a beast.

As I quite possibly will miss some terms as they're too familiar to me, I'd
like to ask that anybody who thinks he has (or had) problems with the terms
used in egcs (both messages and documentation) send me these terms for
inclusion.


Philipp Thomas

-- 
caffeine low .... brain halted

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-29  3:41             ` Alexandre Oliva
@ 1999-04-30 23:15               ` Alexandre Oliva
  0 siblings, 0 replies; 24+ messages in thread
From: Alexandre Oliva @ 1999-04-30 23:15 UTC (permalink / raw)
  To: Joe Buck; +Cc: espie, egcs

On Apr 29, 1999, Joe Buck <jbuck@Synopsys.COM> wrote:

> Correct.  Let's pretend I wrote that. :-)

Sure!  It's copyleft :-)

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-29  0:12         ` Alexandre Oliva
  1999-04-29  3:26           ` Joe Buck
@ 1999-04-30 23:15           ` Alexandre Oliva
  1 sibling, 0 replies; 24+ messages in thread
From: Alexandre Oliva @ 1999-04-30 23:15 UTC (permalink / raw)
  To: Joe Buck; +Cc: Marc Espie, egcs

On Apr 29, 1999, Joe Buck <jbuck@Synopsys.COM> wrote:

> one may replace a class by a derived class.  e.g. I can overload a virtual
                                                              ^^^^
make that override

> 	typedef int (*PFDerived)(Derived&);
> 	int bfunc(Base&);
> 	PFDerived p = &bfunc;

> this is legal

No way!  :-)

You can't touch types of arguments when casting function types.  This
mechanism only works for pointers-to-members:

struct Base { void foo(); };
struct Derived : Base {};
typedef void (Derived::*PFDerived)();
PFDerived pD = &Base::foo;

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-27 23:35 ` Martin v. Loewis
  1999-04-28  0:08   ` Joe Buck
@ 1999-04-30 23:15   ` Martin v. Loewis
  1 sibling, 0 replies; 24+ messages in thread
From: Martin v. Loewis @ 1999-04-30 23:15 UTC (permalink / raw)
  To: kthomas; +Cc: egcs

> As I quite possibly will miss some terms as they're too familiar to me, I'd
> like to ask that anybody who thinks he has (or had) problems with the terms
> used in egcs (both messages and documentation) send me these terms for
> inclusion.

For C++, 'covariant return types', and 'contravariance violation' are
probably most frequently confusing.

Regards,
Martin

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: glossary for egcs - request for contributions
  1999-04-29  3:26           ` Joe Buck
  1999-04-29  3:41             ` Alexandre Oliva
  1999-04-29 21:44             ` Jason Merrill
@ 1999-04-30 23:15             ` Joe Buck
  2 siblings, 0 replies; 24+ messages in thread
From: Joe Buck @ 1999-04-30 23:15 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: jbuck, espie, egcs

> > one may replace a class by a derived class.  e.g. I can overload a virtual
>                                                               ^^^^
> make that override
> 
> > 	typedef int (*PFDerived)(Derived&);
> > 	int bfunc(Base&);
> > 	PFDerived p = &bfunc;
> 
> > this is legal
> 
> No way!  :-)

Alexandre is right, I was wrong, the C++ language is wrong.  (That is,
they should have permitted contravariance for regular function pointers,
not just member function pointers).

> You can't touch types of arguments when casting function types.  This
> mechanism only works for pointers-to-members:
> 
> struct Base { void foo(); };
> struct Derived : Base {};
> typedef void (Derived::*PFDerived)();
> PFDerived pD = &Base::foo;

Correct.  Let's pretend I wrote that. :-)

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~1999-04-30 23:15 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-27 15:24 glossary for egcs - request for contributions Philipp Thomas
1999-04-27 22:16 ` Jeffrey A Law
1999-04-28 10:01   ` Theodore Papadopoulo
1999-04-30 23:15     ` Theodore Papadopoulo
1999-04-30 23:15   ` Jeffrey A Law
1999-04-27 23:35 ` Martin v. Loewis
1999-04-28  0:08   ` Joe Buck
1999-04-28  9:46     ` Marc Espie
1999-04-28 23:48       ` Joe Buck
1999-04-29  0:12         ` Alexandre Oliva
1999-04-29  3:26           ` Joe Buck
1999-04-29  3:41             ` Alexandre Oliva
1999-04-30 23:15               ` Alexandre Oliva
1999-04-29 21:44             ` Jason Merrill
1999-04-30 23:15               ` Jason Merrill
1999-04-30 23:15             ` Joe Buck
1999-04-30 23:15           ` Alexandre Oliva
1999-04-29  0:21         ` Jason Merrill
1999-04-30 23:15           ` Jason Merrill
1999-04-30 23:15         ` Joe Buck
1999-04-30 23:15       ` Marc Espie
1999-04-30 23:15     ` Joe Buck
1999-04-30 23:15   ` Martin v. Loewis
1999-04-30 23:15 ` Philipp Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).