proposed @noreturn attribute

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 17 16:26:18 PDT 2017


On Mon, Jul 17, 2017 at 06:42:02PM -0400, Andrei Alexandrescu via Digitalmars-d wrote:
> On 7/17/17 2:54 PM, H. S. Teoh via Digitalmars-d wrote:
> > I see `typeof(assert(0))` as the same kind of over-engineering of
> > something trivially solved and relatively unimportant ("rarely
> > used") that has unfortunately plagued C++ design and led C++ to
> > become the mess it is today.  It's sad to see D start down the same
> > path...
> 
> There is no reason to over-react seeing as the option of adding a name
> is easy and always available; removing it not so much. This makes
> taking options in language design highly asymmetrical. Having the type
> available as an actual expression brings good options on the table
> because people can return those on unreachable paths etc. -- Andrei

Actually, I don't really care enough about this issue to want it to be
implemented one way or another, as long as there is *some* way to
annotate a non-returning function.

But the point is that so much time and effort is being spent on
discussing and designing a feature that you have admitted yourself to be
"rarely used". As a disinterested bystander I find it somewhat amusing
(and sad) to see so much over-engineering of an overly-complex system
involving a new basic type in the language, which in turn entails all
sorts of corner cases in how it will interact with existing types and
constructs, not to mention the implementation complexities that will be
involved to pull it off -- all for what?  Just to be able to say
"function F doesn't return".  Seems like disproportionate effort for
only marginal returns (har har).


T

-- 
Those who don't understand D are condemned to reinvent it, poorly. -- Daniel N


More information about the Digitalmars-d mailing list