proposed @noreturn attribute
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jul 8 21:00:49 PDT 2017
On Sun, Jul 09, 2017 at 02:01:26AM +0000, sarn via Digitalmars-d wrote:
> On Sunday, 9 July 2017 at 00:16:50 UTC, Walter Bright wrote:
> > We have types that cannot be named (Voldemort types), types that
> > have no type (void), I suppose that types that cannot exist will
> > fill out the edge cases of the menagerie.
> >
> > I assume there is a standard jargon for this - does anyone know Type
> > Theory?
> >
> > Are there any other interesting uses for a type that cannot exist?
Technically, the *type* itself exist, it's just that you cannot create
any instances of it. :-P From the POV of types as sets of possible
values, it's a type that corresponds with an empty set. However, then
we cannot distinguish between void (which is also by definition a type
that has no instances) and noreturn. I'm not sure how to interpret
noreturn in this framework... perhaps a set that doesn't exist? :-P We
could call it a RussellsParadox set. :-D
> In pure functional languages, that's what "bottom" or Haskell's Void
> is.
[...]
Are you sure? IIRC, it's legal to return bottom; it just signifies that
the value is invalid, and that any operation on it will also result in
bottom. Sortof like NaN. That's not the same thing as "this function
never returns".
T
--
The computer is only a tool. Unfortunately, so is the user. -- Armaphine, K5
More information about the Digitalmars-d
mailing list