From 9031390322490679477
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ccb40040597f37a7
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-03-12 12:52:27 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: brangdon@cix.co.uk (Dave Harris)
Newsgroups: comp.std.c++
Subject: Re: Extending enums (was Re: Forward declaration of enum)
Date: Wed, 12 Mar 2003 20:52:27 +0000 (UTC)
Lines: 32
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <memo.20030312121731.48443A@brangdon.madasafish.com>
References: <HFeba.21313$gi1.5997@nwrdny02.gnilink.net>
X-Trace: mail2news.demon.co.uk 1047502347 10616 10.0.0.1 (12 Mar 2003 20:52:27 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 12 Mar 2003 20:52:27 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 18tDD8-0002l4-00
	for mail2news@news.news.demon.net; Wed, 12 Mar 2003 20:52:26 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id HAA15505; Thu, 13 Mar 2003 07:52:23 +1100 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ncar.ucar.edu
X-Newsgroups: comp.std.c++
X-Reply-To: brangdon@cix.co.uk
X-Orig-NNTP-Posting-Host: pc1-clif1-6-cust113.nott.cable.ntl.com (80.4.200.113)
X-Orig-X-Trace: fu-berlin.de 1047471440 68897874 80.4.200.113 (16 [57443])
X-Spam-Status: No, hits=-5.6 required=5.0
	tests=QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01
	version=2.41
Xref: archiver1.google.com comp.std.c++:18293

hyrosen@mail.com (Hyman Rosen) wrote (abridged):
> [enums whose meaning depends on context]
> Ada has this, as part of its general ability to overload by return
> type. In fact, in Ada enumeration literals are considered to be
> parameterless functions which return their enumerator. This makes
> them work in the same way as other overloaded functions.

Agreed. If C++ ever gets overloading by return type, then this enum 
proposal becomes a much smaller change.


> Even when doing overloading by return types, overload resolution
> isn't that complicated to implement. And the problem was solved
> decdes ago.

I don't have a reference, but I recall Stroustrup saying that he knew well 
how to implement overloading by return type. It's easy for compilers. He 
rejected it because he thought it was difficult for humans.

I've looked in D&E but couldn't find any discussion of the point.

  Dave Harris, Nottingham, UK | "Weave a circle round him thrice,
      brangdon@cix.co.uk      |   And close your eyes with holy dread,
                              |  For he on honey dew hath fed
 http://www.bhresearch.co.uk/ |   And drunk the milk of Paradise."

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



