I didn't look through all of the replies to this thread to check
that this hasn't been mentioned yet, but TypeScript uses the
'never' return type for functions that never return.
https://www.typescriptlang.org/docs/handbook/basic-types.html#never
The type isn't used for any optimisations,
On 07/19/2017 10:32 AM, Timon Gehr wrote:
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
On Wednesday, 19 July 2017 at 10:35:37 UTC, 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
On 20.07.2017 00:21, Tobias Müller wrote:
Timon Gehr wrote:
[...]
What I am saying is: in a language with a bottom type, we can create a
function:
T f(T)(Bottom b){
return b; // assuming b converts to all types implicitly.
}
Within the function body, b is a value of
Timon Gehr wrote:
> [...]
> What I am saying is: in a language with a bottom type, we can create a
> function:
>
> T f(T)(Bottom b){
> return b; // assuming b converts to all types implicitly.
> }
>
> Within the function body, b is a value of type Bottom.
> We use a
On 7/16/2017 6:03 AM, Timon Gehr wrote:
pragma(noreturn) is indeed the simpler solution, as it does not interact with
anything else.
Pragmas are not supposed to change the semantics of the code, they are intended
as directions to the compiler, such as:
* optimization suggestions
* embedding
On 19.07.2017 17:14, Moritz Maxeiner wrote:
On Wednesday, 19 July 2017 at 14:52:28 UTC, Timon Gehr wrote:
On 19.07.2017 16:47, Moritz Maxeiner wrote:
On Wednesday, 19 July 2017 at 14:32:24 UTC, Timon Gehr wrote:
On 19.07.2017 14:13, Moritz Maxeiner wrote:
On Wednesday, 19 July 2017 at
On Wednesday, 19 July 2017 at 14:52:28 UTC, Timon Gehr wrote:
On 19.07.2017 16:47, Moritz Maxeiner wrote:
On Wednesday, 19 July 2017 at 14:32:24 UTC, Timon Gehr wrote:
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
On 19.07.2017 16:47, Moritz Maxeiner wrote:
On Wednesday, 19 July 2017 at 14:32:24 UTC, Timon Gehr wrote:
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.
On Wednesday, 19 July 2017 at 14:32:24 UTC, Timon Gehr wrote:
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
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
Am Wed, 19 Jul 2017 12:13:40 +
schrieb Moritz Maxeiner :
> 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
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
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
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
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:
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 ?
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
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
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
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,
On 7/18/2017 7:14 PM, Nicholas Wilson wrote:
It describe the behaviour of the function: I think it is neither necessary nor a
good idea to express it as a type. assert(0) is already accepted as a valid
return statement of any type.
I can't continue this without being repetitive, so we'll just
On Wednesday, 19 July 2017 at 01:52:30 UTC, Walter Bright wrote:
I know how noreturn attributes work - I implemented them
decades ago in DMC and DMC++. They are supported by the DMD
optimizer and back end.
But they are a hack to the type system, and I suggest an
unnecessary one.
It
On 7/18/2017 5:54 PM, Nicholas Wilson wrote:
There is just something fundamentally wrong with:
@noreturn int foo();
I would understand it to mean that if it were to return, foo would return an int
but it is undefined behaviour for foo to dynamically return.
That's the C++ behavior. I know
On Tuesday, 18 July 2017 at 22:03:27 UTC, Walter Bright wrote:
The issue here (for me) is to have a type system that matches
type systems used in type theory. D already has strong
abilities to do type calculus. Instead of inventing our own
whackadoodle scheme, one hack at a time, why not match
On Tuesday, 18 July 2017 at 22:03:27 UTC, Walter Bright wrote:
On 7/17/2017 4:26 PM, H. S. Teoh via Digitalmars-d wrote:
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
On 18.07.2017 23:35, Moritz Maxeiner wrote:
Could you explain why `return foo();` is even legal for a `void foo()
{}`?
Because the ad-hoc decision to make void a type that is not really a
type leads to unnecessary friction, and this exceptional rule removes
the friction in one common
On Tuesday, 18 July 2017 at 21:45:27 UTC, Adam D. Ruppe wrote:
On Tuesday, 18 July 2017 at 21:35:21 UTC, Moritz Maxeiner wrote:
Could you explain why `return foo();` is even legal for a
`void foo() {}`?
Suppose you are writing a template function that forwards:
auto forward(alias fun,
On 7/17/2017 4:26 PM, H. S. Teoh via Digitalmars-d wrote:
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
On Tuesday, 18 July 2017 at 21:35:21 UTC, Moritz Maxeiner wrote:
Could you explain why `return foo();` is even legal for a `void
foo() {}`?
Suppose you are writing a template function that forwards:
auto forward(alias fun, T...)(T args) {
return fun(args);
}
It just saves you from having
On Tuesday, 18 July 2017 at 20:49:56 UTC, Timon Gehr wrote:
On 18.07.2017 20:46, Yuxuan Shui wrote:
On Tuesday, 18 July 2017 at 15:26:59 UTC, Timon Gehr wrote:
On 18.07.2017 14:19, Stefan Koch wrote:
[...]
D has a C-inspired first-order type system, so it is not
necessarily crucial to have
On 18.07.2017 20:46, Yuxuan Shui wrote:
On Tuesday, 18 July 2017 at 15:26:59 UTC, Timon Gehr wrote:
On 18.07.2017 14:19, Stefan Koch wrote:
[...]
D has a C-inspired first-order type system, so it is not necessarily
crucial to have it in D. (The reason I got involved in this thread is
that
On Tuesday, 18 July 2017 at 15:26:59 UTC, Timon Gehr wrote:
On 18.07.2017 14:19, Stefan Koch wrote:
[...]
D has a C-inspired first-order type system, so it is not
necessarily crucial to have it in D. (The reason I got involved
in this thread is that it was proposed to add Bottom as a type
On Monday, 17 July 2017 at 18:54:37 UTC, H. S. Teoh wrote:
On Mon, Jul 17, 2017 at 02:10:27PM -0400, Andrei Alexandrescu
via Digitalmars-d wrote:
[...]
[...]
IMO, the observations "used rarely" and "attention-seeking
notation" are better satisfied by an attribute named @noreturn
than some
On 18.07.2017 14:19, Stefan Koch wrote:
On Tuesday, 18 July 2017 at 12:15:06 UTC, Timon Gehr wrote:
On 18.07.2017 12:17, John Colvin wrote:
Better to just not define it.
That's not an option. Bottom is a subtype of all types. It cannot
remove members, even static ones.
Timon, how
On Tuesday, 18 July 2017 at 12:15:06 UTC, Timon Gehr wrote:
On 18.07.2017 12:17, John Colvin wrote:
Better to just not define it.
That's not an option. Bottom is a subtype of all types. It
cannot remove members, even static ones.
Timon, how important is it to actually have bottom ?
...
On 18.07.2017 12:17, John Colvin wrote:
Better to just not define it.
That's not an option. Bottom is a subtype of all types. It cannot remove
members, even static ones.
On Tuesday, 18 July 2017 at 10:17:17 UTC, John Colvin wrote:
how do I store the type "int" in memory?
new Type(TYENUM.Tint32); :o)
On Monday, 17 July 2017 at 23:01:40 UTC, Walter Bright wrote:
On 7/16/2017 5:41 AM, Timon Gehr wrote:
struct S{
T x;
Bottom everything;
}
turns the entire struct into an empty type. It is therefore
most natural to say that Bottom.sizeof == ∞. (It's the only
choice for which S.sizeof
On Monday, 17 July 2017 at 18:10:27 UTC, Andrei Alexandrescu
wrote:
On 7/17/17 11:39 AM, Olivier FAURE wrote:
I'd really prefer if you avoided the whole `typeof(assert(0))`
thing.
First off, it's way too verbose for a simple concept.
Noted, thanks. I won't debate this much but for now I
On 18.07.2017 03:06, Walter Bright wrote:
On 7/17/2017 5:13 PM, Timon Gehr wrote:
(Reminds me of divide by 0 discussions in calculus class.)
The reason division by 0 is left undefined is that instead saying 1/0
= ∞ introduces a new number ∞ that does not play nice with the axioms
of a
On 7/17/2017 5:13 PM, Timon Gehr wrote:
(Reminds me of divide by 0 discussions in calculus class.)
The reason division by 0 is left undefined is that instead saying 1/0 = ∞
introduces a new number ∞ that does not play nice with the axioms of a complete
ordered field.
The question for
On Monday, 17 July 2017 at 18:54:37 UTC, H. S. Teoh wrote:
IMO, the observations "used rarely" and "attention-seeking
notation" are better satisfied by an attribute named @noreturn
than some strange, convoluted, arcane invocation like
`typeof(assert(0))`. Because:
(1) "used rarely" means it
On 7/17/2017 5:06 PM, Seb via Digitalmars-d wrote:
I can't agree more. This is textbook procrastination and bike-shedding [1]!
There are dozens of open regressions that could have fixed or great,
stalled PRs that could have been reviewed.
In fact if only PRs would be as heartily reviewed as
On 18.07.2017 01:01, Walter Bright wrote:
...
But if Bottom does not exist, then S doesn't exist either, and hence the
< size relationship has no meaning.
...
Both Bottom and S exist, but they have no instances.
(Reminds me of divide by 0 discussions in calculus class.)
The reason
On Monday, 17 July 2017 at 23:26:18 UTC, H. S. Teoh wrote:
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 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
On 7/16/2017 5:41 AM, Timon Gehr wrote:
struct S{
T x;
Bottom everything;
}
turns the entire struct into an empty type. It is therefore most natural to say
that Bottom.sizeof == ∞. (It's the only choice for which S.sizeof ==
Bottom.sizeof.)
Another way to think about it: If
On 7/16/2017 1:15 PM, Timon Gehr wrote:
In this case, Bottom.sizeof is a value of type Bottom, which must not exist.
T.sizeof is a value of type size_t, not type T.
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
On Monday, 17 July 2017 at 18:54:37 UTC, H. S. Teoh wrote:
On Mon, Jul 17, 2017 at 02:10:27PM -0400, Andrei Alexandrescu
via Digitalmars-d wrote:
On 7/17/17 11:39 AM, Olivier FAURE wrote:
> I'd really prefer if you avoided the whole
> `typeof(assert(0))`
> thing.
>
> First off, it's way too
On Mon, Jul 17, 2017 at 02:10:27PM -0400, Andrei Alexandrescu via Digitalmars-d
wrote:
> On 7/17/17 11:39 AM, Olivier FAURE wrote:
> > I'd really prefer if you avoided the whole `typeof(assert(0))`
> > thing.
> >
> > First off, it's way too verbose for a simple concept.
>
> Noted, thanks. I
On 7/17/17 11:39 AM, Olivier FAURE wrote:
I'd really prefer if you avoided the whole `typeof(assert(0))` thing.
First off, it's way too verbose for a simple concept.
Noted, thanks. I won't debate this much but for now I disagree. The "no
return" type has several particular properties that
On Monday, 17 July 2017 at 15:39:30 UTC, Olivier FAURE wrote:
On Sunday, 16 July 2017 at 20:44:13 UTC, Andrei Alexandrescu
wrote:
An issue is that we already have typeof(null). typeof(null)
and typeof(assert(0))* are two ways to specify almost the
same thing. One question is whether
On Sunday, 16 July 2017 at 20:44:13 UTC, Andrei Alexandrescu
wrote:
An issue is that we already have typeof(null). typeof(null)
and typeof(assert(0))* are two ways to specify almost the same
thing. One question is whether typeof(assert(0))* and
typeof(null) should be the same, or if the former
On Sunday, 16 July 2017 at 20:15:11 UTC, Timon Gehr wrote:
On 16.07.2017 21:49, Guillaume Boucher wrote:
On Sunday, 16 July 2017 at 12:41:06 UTC, Timon Gehr wrote:
It is therefore most natural to say that Bottom.sizeof == ∞.
True, but size_t.max doesn't have the properties of ∞.
The only
On Sunday, 16 July 2017 at 20:04:25 UTC, Timon Gehr wrote:
The issue isn't purism, it is type safety. If you create an
EvolvedPenguin, upcast it to a Penguin and call the fly method
you get UB. So noreturn would indeed need to enforce that all
overrides are also noreturn.
I see it as some
On 07/13/2017 01:25 PM, Timon Gehr wrote:
On Wednesday, 12 July 2017 at 14:23:15 UTC, Andrei Alexandrescu wrote:
On 07/12/2017 05:32 AM, Timon Gehr wrote:
On 09.07.2017 23:45, Meta wrote:
...
Another case that we should probably just statically disallow:
... > This obviously doesn't make any
On 07/16/2017 04:15 PM, Timon Gehr wrote:
On 16.07.2017 21:49, Guillaume Boucher wrote:
On Sunday, 16 July 2017 at 12:41:06 UTC, Timon Gehr wrote:
It is therefore most natural to say that Bottom.sizeof == ∞.
True, but size_t.max doesn't have the properties of ∞.
The only sane choice to me
On 16.07.2017 21:49, Guillaume Boucher wrote:
On Sunday, 16 July 2017 at 12:41:06 UTC, Timon Gehr wrote:
It is therefore most natural to say that Bottom.sizeof == ∞.
True, but size_t.max doesn't have the properties of ∞.
The only sane choice to me seems to be a value of type Bottom, i.e.
On 16.07.2017 21:49, Guillaume Boucher wrote:
I'd say a function with return type Bottom can override any function
in the base class.
That solves the "Penguin : Bird" step, but not "EvolvedPenguin :
Penguin" (which can fly).
Andrei argues that my example don't comply with a puristic
On Sunday, 16 July 2017 at 12:41:06 UTC, Timon Gehr wrote:
It is therefore most natural to say that Bottom.sizeof == ∞.
True, but size_t.max doesn't have the properties of ∞.
The only sane choice to me seems to be a value of type Bottom,
i.e. is(typeof(Bottom.sizeof) == Bottom).
On Sunday, 16 July 2017 at 13:03:40 UTC, Timon Gehr wrote:
I don't think that's true. A Bottom type does not cover all
use cases of @noreturn/@pragma(noreturn).
...
I think it does, but it is a significantly more invasive
language change.
The best you can hope for is that any code with
On 14.07.2017 17:39, Guillaume Boucher wrote:
On Monday, 10 July 2017 at 04:02:59 UTC, Nicholas Wilson wrote:
1)@noreturn
2)@disable(return)
3)none
w.r.t optimisation assuming both 1 & 3 impact DMD equally [...]
I don't think that's true. A Bottom type does not cover all use cases
of
On 07/15/2017 11:30 PM, Walter Bright wrote:
On 7/13/2017 5:18 PM, Andrei Alexandrescu wrote:
On 7/13/17 2:37 PM, Timon Gehr wrote:
On Thursday, 13 July 2017 at 17:25:18 UTC, Timon Gehr wrote:
Anyway, my assertion that Bottom cannot be a subtype of all other
types was actually incorrect: the
On 16.07.2017 05:30, Walter Bright wrote:
On 7/13/2017 5:18 PM, Andrei Alexandrescu wrote:
On 7/13/17 2:37 PM, Timon Gehr wrote:
On Thursday, 13 July 2017 at 17:25:18 UTC, Timon Gehr wrote:
Anyway, my assertion that Bottom cannot be a subtype of all other
types was actually incorrect: the
On 7/13/2017 5:18 PM, Andrei Alexandrescu wrote:
On 7/13/17 2:37 PM, Timon Gehr wrote:
On Thursday, 13 July 2017 at 17:25:18 UTC, Timon Gehr wrote:
Anyway, my assertion that Bottom cannot be a subtype of all other types was
actually incorrect: the compiler does not need to generate code for
On 07/14/2017 03:06 PM, Lurker wrote:
On Friday, 14 July 2017 at 15:39:01 UTC, Guillaume Boucher wrote:
Example 1: Polymorphism
class Bird { void fly() { ... } };
class Penguin : Bird { override void fly() @pragma(noreturn) {
assert(0); } };
class EvolvedPenguin : Penguin { override void
On Friday, 14 July 2017 at 15:39:01 UTC, Guillaume Boucher wrote:
Example 1: Polymorphism
class Bird { void fly() { ... } };
class Penguin : Bird { override void fly() @pragma(noreturn) {
assert(0); } };
class EvolvedPenguin : Penguin { override void fly() { ... } };
No matter how you
On Monday, 10 July 2017 at 04:02:59 UTC, Nicholas Wilson wrote:
1)@noreturn
2)@disable(return)
3)none
w.r.t optimisation assuming both 1 & 3 impact DMD equally [...]
I don't think that's true. A Bottom type does not cover all use
cases of @noreturn/@pragma(noreturn).
Example 1:
On 7/13/17 2:37 PM, Timon Gehr wrote:
On Thursday, 13 July 2017 at 17:25:18 UTC, Timon Gehr wrote:
Anyway, my assertion that Bottom cannot be a subtype of all other
types was actually incorrect: the compiler does not need to generate
code for implicit conversion from Bottom to some other type,
On Saturday, 8 July 2017 at 20:27:11 UTC, H. S. Teoh wrote:
Also, a @noreturn attribute would allow overriding a non-void
class method with a @noreturn one (e.g. the derived class is a
sentinel object that forces an exception / termination upon
calling that method), whereas you can't do that
On Thursday, 13 July 2017 at 17:25:18 UTC, Timon Gehr wrote:
Anyway, my assertion that Bottom cannot be a subtype of all
other types was actually incorrect: the compiler does not need
to generate code for implicit conversion from Bottom to some
other type, so it can be treated as a subtype.
On Wednesday, 12 July 2017 at 14:23:15 UTC, Andrei Alexandrescu
wrote:
On 07/12/2017 05:32 AM, Timon Gehr wrote:
On 09.07.2017 23:45, Meta wrote:
...
Another case that we should probably just statically disallow:
... > This obviously doesn't make any sense anyway
... > I don't see a reason for
On 07/12/2017 05:32 AM, Timon Gehr wrote:
On 09.07.2017 23:45, Meta wrote:
...
Another case that we should probably just statically disallow:
... > This obviously doesn't make any sense anyway
... > I don't see a reason for us to ever need to do that
Sorry, but this thinking has no place in
On Wednesday, 12 July 2017 at 09:32:32 UTC, Timon Gehr wrote:
On 09.07.2017 23:45, Meta wrote:
...
Another case that we should probably just statically disallow:
... > This obviously doesn't make any sense anyway
... > I don't see a reason for us to ever need to do that
Sorry, but this thinking
On 09.07.2017 23:45, Meta wrote:
...
Another case that we should probably just statically disallow:
... > This obviously doesn't make any sense anyway
... > I don't see a reason for us to ever need to do that
Sorry, but this thinking has no place in type system design. This is
precisely how you
On 11.07.2017 19:27, Meta wrote:
On Tuesday, 11 July 2017 at 08:29:12 UTC, Timon Gehr wrote:
On 10.07.2017 18:23, Meta wrote:
...
problems with stuff like typeof(null)* etc. because for the most part
it's just a regular type, unlike Bottom.
Bottom is just a regular type.
It's a regular
On 12.07.2017 03:50, Andrei Alexandrescu wrote:
On 7/11/17 4:29 AM, Timon Gehr wrote:
On 10.07.2017 18:23, Meta wrote:
...
problems with stuff like typeof(null)* etc. because for the most part
it's just a regular type, unlike Bottom.
Bottom is just a regular type.
Wouldn't the fact that
On 7/11/17 4:29 AM, Timon Gehr wrote:
On 10.07.2017 18:23, Meta wrote:
...
problems with stuff like typeof(null)* etc. because for the most part
it's just a regular type, unlike Bottom.
Bottom is just a regular type.
Wouldn't the fact that it's a subtype of all other types make it a bit
On Saturday, 8 July 2017 at 12:18:38 UTC, Andrei Alexandrescu
wrote:
On 7/8/17 7:07 AM, bachmeier wrote:
On Saturday, 8 July 2017 at 10:15:39 UTC, Walter Bright wrote:
Having an @noreturn attribute will take care of that:
@noreturn void ThisFunctionExits();
Why should this be an
On Monday, 10 July 2017 at 20:00:10 UTC, Steven Schveighoffer
wrote:
This means that you get errors for some instantiations. Which
ironically means you'd need to do something like this:
void foo(alias f)()
{
f();
static if(!isNoreturn!f)
{
auto a = 5;
...// etc.
}
}
On Tuesday, 11 July 2017 at 08:29:12 UTC, Timon Gehr wrote:
On 10.07.2017 18:23, Meta wrote:
...
problems with stuff like typeof(null)* etc. because for the
most part it's just a regular type, unlike Bottom.
Bottom is just a regular type.
It's a regular type with unusual behaviour due to
On 10.07.2017 04:44, Walter Bright wrote:
Let's call the bottom type 'B' for the moment, for convenience.
If we think of it like a floating point NaN,
It's not. It's an empty type.
then any type construction
of B yields a B:
const(B) -> B
I don't see why to add this special case.
On 10.07.2017 18:23, Meta wrote:
...
problems with stuff like typeof(null)* etc. because for the most part
it's just a regular type, unlike Bottom.
Bottom is just a regular type.
On 2017-07-11 09:37, Iain Buclaw via Digitalmars-d wrote:
Right, you can't put noreturn on enforce itself, but you can on the
internal bailOut function called by enforce.
Ah, but I though it would just contain a "throw" for the case the the
condition is false. I see now that it doesn't.
--
On 08.07.2017 12:15, Walter Bright wrote:
C compilers (and by extension C++ compilers) usually have an extension
which allows a function to be marked as one that never returns. The
point of this is it enables improved data flow analysis and better code
being generated.
Noreturn functions
On 11 July 2017 at 08:46, Jacob Carlborg via Digitalmars-d
wrote:
> On 2017-07-10 22:00, Walter Bright wrote:
>
>> Yes. Not having it makes enforce(), for example, generate poor code.
>
>
> Not sure I understand. "enforce" will return if the condition is true.
>
On 2017-07-10 22:00, Walter Bright wrote:
Yes. Not having it makes enforce(), for example, generate poor code.
Not sure I understand. "enforce" will return if the condition is true.
--
/Jacob Carlborg
Am Sat, 8 Jul 2017 03:15:39 -0700
schrieb Walter Bright :
> […]
>
> Having an @noreturn attribute will take care of that:
>
> @noreturn void ThisFunctionExits();
>
> Yes, it's another builtin attribute and attributes are arguably a failure in
> language design.
On 7/10/2017 12:02 PM, Jacob Carlborg wrote:
Are those few cases worth optimizing for?
Yes. Not having it makes enforce(), for example, generate poor code.
On 7/10/17 3:05 PM, Meta wrote:
On Monday, 10 July 2017 at 18:50:54 UTC, Steven Schveighoffer wrote:
On 7/10/17 2:38 PM, Walter Bright wrote:
On 7/10/2017 4:00 AM, Steven Schveighoffer wrote:
But I have to ask, what is the benefit of statically determining
that a function is noreturn?
It is
On 7/10/2017 12:05 PM, Meta wrote:
Currently not. This is either a bug or the compiler's flow analysis is not
robust enough to detect this case.
Flow analysis relies on the function's signature, not its implementation, and
currently the signature contains no information about noreturn.
Jacob Carlborg wrote:
I'm going to ask the stupid question: I understand that this is for the
compiler to generate better code. But, since the attribute (or whatever
it is) indicates that a function won't return, it can only be used in
very few cases. Are those few cases worth optimizing for?
On Monday, 10 July 2017 at 18:09:54 UTC, H. S. Teoh wrote:
On Sun, Jul 09, 2017 at 02:49:35PM -0400, Nick Sabalausky
(Abscissa) via Digitalmars-d wrote:
On 07/09/2017 06:51 AM, Daniel N wrote:
> On Sunday, 9 July 2017 at 10:31:47 UTC, Mr.D wrote:
> > On Saturday, 8 July 2017 at 10:15:39 UTC,
On Monday, 10 July 2017 at 18:50:54 UTC, Steven Schveighoffer
wrote:
On 7/10/17 2:38 PM, Walter Bright wrote:
On 7/10/2017 4:00 AM, Steven Schveighoffer wrote:
But I have to ask, what is the benefit of statically
determining that a function is noreturn?
It is useful anywhere dataflow
On 2017-07-08 12:15, Walter Bright wrote:
C compilers (and by extension C++ compilers) usually have an extension
which allows a function to be marked as one that never returns. The
point of this is it enables improved data flow analysis and better code
being generated.
Noreturn functions crop
On 7/10/17 2:38 PM, Walter Bright wrote:
On 7/10/2017 4:00 AM, Steven Schveighoffer wrote:
But I have to ask, what is the benefit of statically determining that
a function is noreturn?
It is useful anywhere dataflow analysis is useful.
FunctionThatDoesnotReturn();
a = b; // error:
On 7/10/2017 4:00 AM, Steven Schveighoffer wrote:
But I have to ask, what is the benefit of statically determining that a function
is noreturn?
It is useful anywhere dataflow analysis is useful.
FunctionThatDoesnotReturn();
a = b; // error: unreachable code
On Sun, Jul 09, 2017 at 02:49:35PM -0400, Nick Sabalausky (Abscissa) via
Digitalmars-d wrote:
> On 07/09/2017 06:51 AM, Daniel N wrote:
> > On Sunday, 9 July 2017 at 10:31:47 UTC, Mr.D wrote:
> > > On Saturday, 8 July 2017 at 10:15:39 UTC, Walter Bright wrote:
> > >
> > > > Has anyone a better
1 - 100 of 180 matches
Mail list logo