From 445943841274368836
X-Google-Thread: f78e5,1e6093a60facd084
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,UTF8
Path: g2news2.google.com!news2.google.com!news1.google.com!news.germany.com!feeder.news-service.com!newsgate.cistron.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsinpeer00.lnd.ops.eu.uu.net!emea.uu.net!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: SeeWebsiteForEmail@erdani.org ("Andrei Alexandrescu (See Website For Email)")
Newsgroups: comp.std.c++
Subject: Re: [Proposal] noreturn_t
Date: Sun,  5 Nov 2006 03:14:26 GMT
Organization: Computer Science & Engineering, U of Washington, Seattle
Lines: 63
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <454D4690.8020709@erdani.org>
References: <1161490402.699940.293180@b28g2000cwb.googlegroups.com> <QuO0h.40384$V%7.8695@reader1.news.jippii.net> <4544215C.4020102@erdani.org> <zA63h.45427$QF5.4075@reader1.news.jippii.net>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: news.demon.co.uk 1162697978 3423 158.152.254.254 (5 Nov 2006 03:39:38 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Sun, 5 Nov 2006 03:39:38 +0000 (UTC)
X-Nntp-Posting-Host: tisbe.cs.washington.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.csse.unimelb.edu.au id kA53dZhH016707
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-Path: comp-std-cpp-robomod!not-for-mail
X-Received: (from fjh@localhost)
	by mulga.csse.unimelb.edu.au (8.13.6+Sun/8.13.6/Submit) id kA53EQOj012238;
	Sun, 5 Nov 2006 14:14:26 +1100 (EST)
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news2.google.com comp.std.c++:4341

Tommi H=C3=B6yn=C3=A4l=C3=A4nmaa wrote:
> Andrei Alexandrescu (See Website For Email) kirjoitti:
>> Tommi H=C3=B6yn=C3=A4l=C3=A4nmaa wrote:
>>> This is a question about the execution flow and not about the result=20
>>> type of a function. There would be no values whose type is noreturn_t.
>>> So "noreturn" should be an attribute of a function like the throw=20
>>> specifications.
>>
>> The point of the idea was different. Yes, values of that type cannot=20
>> exist, but the properties of the static type control the=20
>> expressiveness of the idioms in which the type could take part. And=20
>> precisely because values of that "none" type can never exist, there is=
=20
>> considerable static freedom with regard to the static properties of=20
>> that type, which confers it remarkable expressiveness.
>=20
> But isn't "none" roughly equivalent to the void result type in C++?
> Function that returns nothing has also a result type that contains no=20
> values. Or does it have some other result type? I think this type shoul=
d=20
> also be at the bottom of the type hierarchy.

There are similarities between void and none, but also obvious=20
differences. I think we've beaten this horse long enough :o).

>>> There could be another attribute "mustreturn" to indicate that a=20
>>> function has to return. "mustreturn" and "noreturn" would be mutually=
=20
>>> exclusive.
>>
>> I guess mustreturn is simply a static incarnation of the nothrow idea.=
=20
>> Things get tricky when we start thinking of mustreturn as a guarantee=20
>> that the function doesn't enter infinite loops - it wouldn't generally=
=20
>> be quite possible to demonstrate that a function violates that=20
>> assumption :o).
>=20
> We could define "mustreturn" e.g. so that
> 1) A "mustreturn" function may call only other "mustreturn" functions
> or
> 2) A "mustreturn" function may not call any "noreturn" functions.
> Infinite loops and things like that would not be considered at all.
> The semantics of "mustreturn" would be a bit unclear this way because i=
t=20
> would be possible that a "mustreturn" function executes an infinite tim=
e.
>=20
> However, it may be that "mustreturn" is not worth implementing.

I also don't think "mustreturn" has much value. For a host of=20
theoretical and practical reasons, "nothrow" is much more worthy=20
focusing on.


Andrei

---
[ 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.comeaucomputing.com/csc/faq.html                      ]



