July 19, 2017 Re: proposed @noreturn attribute | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marc Schütz | On Wednesday, 19 July 2017 at 10:24:35 UTC, Marc Schütz wrote:
> On Sunday, 16 July 2017 at 20:44:13 UTC, Andrei Alexandrescu wrote:
>> Perhaps we go the inverse route and define the bottom type as typeof(*null). Would that simplify matters? There is some good consistency about it:
>>
>> null: a pointer to anything. But can't be dereferenced.
>> *null: well, therefore... anything. But can't be created.
>
> That sounds more like a top type, though, because as you said it can be "anything". A bottom type can not be anything, but only nothing.
It's the bottom.
Bottom is to Types, as Object is to Classes.
|
July 19, 2017 Re: proposed @noreturn attribute | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marc Schütz | On 19.07.2017 12:24, Marc Schütz wrote:
> On Sunday, 16 July 2017 at 20:44:13 UTC, Andrei Alexandrescu wrote:
>> Perhaps we go the inverse route and define the bottom type as typeof(*null). Would that simplify matters? There is some good consistency about it:
>>
>> null: a pointer to anything. But can't be dereferenced.
>> *null: well, therefore... anything. But can't be created.
>
> That sounds more like a top type, though, because as you said it can be "anything". A bottom type can not be anything, but only nothing.
>
There is nothing that can be anything, but anything can be top.
Natural language has an unfortunate tendency to blur the distinction between dual concepts as it gets more informal.
|
July 19, 2017 Re: proposed @noreturn attribute | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On 19.07.2017 12:35, Stefan Koch wrote:
> On Wednesday, 19 July 2017 at 10:24:35 UTC, Marc Schütz wrote:
>> On Sunday, 16 July 2017 at 20:44:13 UTC, Andrei Alexandrescu wrote:
>>> Perhaps we go the inverse route and define the bottom type as typeof(*null). Would that simplify matters? There is some good consistency about it:
>>>
>>> null: a pointer to anything. But can't be dereferenced.
>>> *null: well, therefore... anything. But can't be created.
>>
>> That sounds more like a top type, though, because as you said it can be "anything". A bottom type can not be anything, but only nothing.
>
> It's the bottom.
> Bottom is to Types, as Object is to Classes.
>
No. Bottom is to types as typeof(null) is to class types.
|
July 19, 2017 Re: proposed @noreturn attribute | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On Wednesday, 19 July 2017 at 10:44:22 UTC, Timon Gehr wrote:
>
> No. Bottom is to types as typeof(null) is to class types.
I fear you lost me again :)
as far as I understood your previous explanation, every type is a subtype of bottom, is that incorrect ?
|
July 19, 2017 Re: proposed @noreturn attribute | ||||
---|---|---|---|---|
| ||||
Posted in reply to Meta | On Wednesday, 12 July 2017 at 13:22:46 UTC, Meta wrote: > D is not ML or Haskell or Idris. Rust has trod this ground before us and they saw it prudent to not make ! a first-class type. Only to turn around after they realized their mistake: https://doc.rust-lang.org/stable/book/second-edition/ch19-04-advanced-types.html#the-never-type--that-never-returns |
July 19, 2017 Re: proposed @noreturn attribute | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On 19.07.2017 12:59, Stefan Koch wrote:
> On Wednesday, 19 July 2017 at 10:44:22 UTC, Timon Gehr wrote:
>>
>> No. Bottom is to types as typeof(null) is to class types.
>
> I fear you lost me again :)
>
> as far as I understood your previous explanation, every type is a subtype of bottom, is that incorrect ?
It is the other way around. Bottom is a subtype of every type / a value of type bottom can be used to construct a value for any other type.
|
July 19, 2017 Re: proposed @noreturn attribute | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On Wednesday, 19 July 2017 at 11:35:47 UTC, Timon Gehr wrote:
> a value of type bottom can be used to construct a value for any other type.
AFAIK from type theory, bottom is defined as having no values (so one can't reason about the relationship of such non-existent value(s) to values of other types).
|
July 19, 2017 Re: proposed @noreturn attribute | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marc Schütz | On Wednesday, 19 July 2017 at 11:02:07 UTC, Marc Schütz wrote:
> On Wednesday, 12 July 2017 at 13:22:46 UTC, Meta wrote:
>> D is not ML or Haskell or Idris. Rust has trod this ground before us and they saw it prudent to not make ! a first-class type.
>
> Only to turn around after they realized their mistake:
>
> https://doc.rust-lang.org/stable/book/second-edition/ch19-04-advanced-types.html#the-never-type--that-never-returns
That page doesn't say anything about passing ! as a type to generic functions (what I'm referring to), but it seems the following code does compile on Rust nightly with the #![feature(never_type)] directive:
fn test<T>() {}
fn main() {
test::<!>();
}
So it seems my Rust knowledge is about a year out of date.
|
July 19, 2017 Re: proposed @noreturn attribute | ||||
---|---|---|---|---|
| ||||
Posted in reply to Moritz Maxeiner | Am Wed, 19 Jul 2017 12:13:40 +0000 schrieb Moritz Maxeiner <moritz@ucworks.org>: > On Wednesday, 19 July 2017 at 11:35:47 UTC, Timon Gehr wrote: > > a value of type bottom can be used to construct a value for any other type. > > AFAIK from type theory, bottom is defined as having no values (so one can't reason about the relationship of such non-existent value(s) to values of other types). 2018, Dlang is now an esoteric language. After a long bike-shedding the "bottom type" has been named "nirvana" and assigning it to a variable of any other type signifies intent to give the program a reincarnation. On Posix this was efficiently implemented via fork and exec, Windows implementation is still suffering from bad vibes (bugs). Phobos comes in several flavors now, because it was discovered that one Phobos can never be enough to capture all the worlds paradigms and was considered the main offender to peace on the forums. So there is now an assembly optimized fast Phobos for performance fans without safety nor GC; a type theory Phobos that tries hard to hide the fact that structs have a fixed data layout and makes types first class citizens, but doesn't interop with C at all; an auto-decoding Phobos; and a batteries included Phobos with database drivers, audio, image and GUI bindings. -- Marco |
July 19, 2017 Re: proposed @noreturn attribute | ||||
---|---|---|---|---|
| ||||
Posted in reply to Moritz Maxeiner | On 19.07.2017 14:13, Moritz Maxeiner wrote: > On Wednesday, 19 July 2017 at 11:35:47 UTC, Timon Gehr wrote: >> a value of type bottom can be used to construct a value for any other type. > > AFAIK from type theory, bottom is defined as having no values (so one can't reason about the relationship of such non-existent value(s) to values of other types). https://en.wikipedia.org/wiki/Principle_of_explosion |
Copyright © 1999-2021 by the D Language Foundation