🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #435

Re: Using return datum type in function signature

#435
From: Mark A Terribile
Date: Mon, 03 Sep 1990 04:04
42 lines
2217 bytes
In article <4335@celery34.UUCP>, stephens@motcid.UUCP (Kurt Stephens) writes:
> Why isn't the return datum type used in the construction of
> a function signature?  Would it be helpful to have overloaded
> with the same argument signatures but different return types?

 . . .

> Is this impossible because the call to Get() can only 
> be disambiguated by examining the surrounding context?


You've hit upon it, more or less.  In many languages (Ada included)
the context can be used to help in disambiguation.  C's very flexible
expression syntax and semantics are such that, were C++ to allow such
disambiguation, the rules that would have to be applied would prevent
`ordinary' C things from working correctly.

For example, if you have a pair of overloads disambiguated only by
their return values  (say an  int s()  and an  X s() ) and you call
the function at the top level of an expression statement, i.e. as

		{
			s();
		}

how do you disambiguate?  Even if you argue that you are converting the
return values to  void , on the basis of what could you prefer one
conversion to  void  over another?

In other languages, expressions are tightly constrained things; in C and
C++, they are the world.  There is an almost LISPis quality about them,
and that means that there are things you cannot do.

It should be noted that it took several months and a number of papers
in various journals before the computing community solidly established
that there is a usable algorithm for Ada-style disambiguation.  It may
take four passes over the expression tree before everything is fully
disambiguated.
-- 

 (This man's opinions are his own.)
 From mole-end				Mark Terribile
Technical Details
Message-ID: <431@mole-end.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!wuarchive!emory!att!westmark!mole-end!mat
References: <4335@celery34.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!wuarchive!emory!att!westmark!mole-end!mat
From: mat@mole-end.UUCP (Mark A Terribile)
Newsgroups: comp.std.c++,comp.lang.c++
Subject: Re: Using return datum type in function signature
Summary: Ada, yes.  C++, no.
Keywords: c++,signature
Message-ID: <431@mole-end.UUCP>
Date: 3 Sep 90 04:04:30 GMT
References: <4335@celery34.UUCP>
Distribution: comp
Organization: mole-end--private system.  admin: mole-end!newtnews
Lines: 42