Jump to page: 1 29  
Page
Thread overview
nothrow by default
Jan 04, 2020
Mike Parker
Jan 04, 2020
Walter Bright
Jan 04, 2020
JN
Jan 04, 2020
IGotD-
Jan 05, 2020
Jacob Carlborg
Jan 10, 2020
Walter Bright
Jan 04, 2020
Adam D. Ruppe
Jan 05, 2020
Walter Bright
Jan 05, 2020
Johannes Pfau
Jan 05, 2020
Gregor Mückl
Jan 05, 2020
Johannes Pfau
Jan 05, 2020
JN
Jan 05, 2020
Johannes Pfau
Jan 05, 2020
Johannes Pfau
Jan 09, 2020
Walter Bright
Jan 05, 2020
rikki cattermole
Jan 05, 2020
rikki cattermole
Jan 05, 2020
rikki cattermole
Jan 05, 2020
rikki cattermole
Jan 10, 2020
Jesse Phillips
Jan 10, 2020
Jesse Phillips
Jan 10, 2020
Jesse Phillips
Jan 11, 2020
Jesse Phillips
Jan 11, 2020
Jonathan M Davis
Jan 09, 2020
Walter Bright
Jan 09, 2020
Jonathan M Davis
Jan 09, 2020
Andre Pany
Jan 09, 2020
Guillaume Piolat
Jan 09, 2020
Paulo Pinto
Jan 09, 2020
Paulo Pinto
Jan 09, 2020
bachmeier
Jan 09, 2020
Timon Gehr
Jan 10, 2020
Walter Bright
Jan 10, 2020
Timon Gehr
Jan 10, 2020
Jonathan M Davis
Jan 10, 2020
Gregor Mückl
Jan 10, 2020
Walter Bright
Jan 10, 2020
Mathias Lang
Jan 09, 2020
Adam D. Ruppe
Jan 09, 2020
H. S. Teoh
Jan 09, 2020
Johannes Pfau
Jan 09, 2020
H. S. Teoh
Jan 09, 2020
Johannes Pfau
Jan 09, 2020
Johannes Pfau
Jan 10, 2020
Walter Bright
Jan 10, 2020
Gregor Mückl
Jan 10, 2020
Walter Bright
Jan 10, 2020
Gregor Mückl
Jan 10, 2020
Guillaume Piolat
Jan 10, 2020
Sebastiaan Koppe
Jan 09, 2020
Paulo Pinto
Jan 09, 2020
SealabJaster
Jan 04, 2020
rikki cattermole
Jan 04, 2020
Adam D. Ruppe
Jan 04, 2020
Jonathan M Davis
Jan 04, 2020
Dennis
Jan 04, 2020
Adam D. Ruppe
Jan 04, 2020
Dennis
Jan 04, 2020
Les De Ridder
Jan 04, 2020
Walter Bright
Jan 05, 2020
apz28
Jan 05, 2020
berni44
Jan 07, 2020
Andrea Fontana
Jan 06, 2020
Guillaume Piolat
Jan 06, 2020
Paul Backus
Jan 06, 2020
Guillaume Piolat
January 04, 2020
Just wanted to bring this up, and not muddy the other thread.

What do you put if you throw? @safe by default has alternatives. nothrow does not. Are we going to get a new keyword/uda?

-Steve
January 04, 2020
On Saturday, 4 January 2020 at 16:05:10 UTC, Steven Schveighoffer wrote:
> Just wanted to bring this up, and not muddy the other thread.
>
> What do you put if you throw? @safe by default has alternatives. nothrow does not. Are we going to get a new keyword/uda?
>
> -Steve

Seems like we'd have to. Or on/off attribute parameters.
January 05, 2020
On 05/01/2020 5:05 AM, Steven Schveighoffer wrote:
> Just wanted to bring this up, and not muddy the other thread.
> 
> What do you put if you throw? @safe by default has alternatives. nothrow does not. Are we going to get a new keyword/uda?
> 
> -Steve

Well we could use throw, or add throws like in Java.

But after Java I do think we have the right defaults for exceptions in general. The Java way forces you to use the IDE to handle that stuff, instead of yourself. Which would be a major loss for D.
January 04, 2020
On Saturday, 4 January 2020 at 16:05:10 UTC, Steven Schveighoffer wrote:
> We we going to get a new keyword/uda?

this should be done regardless of defaults! for ALL these attributes. We should do that and perhaps figure out it going into scopes too.

nothrow:
struct A {
   void foo() throws {} // the nothrow could be inherited from outside if it is overridable inside.
}


nothrow by default btw I'm.... concerned about. but if we fixed the anti-attributes and descending into scopes it is far more manageable regardless of default.
January 04, 2020
On Saturday, January 4, 2020 9:05:10 AM MST Steven Schveighoffer via Digitalmars-d wrote:
> Just wanted to bring this up, and not muddy the other thread.
>
> What do you put if you throw? @safe by default has alternatives. nothrow does not. Are we going to get a new keyword/uda?

We really should add a way to negate all of the attributes regardless of the defaults, but nothrow by default would be terrible IMHO. Aside from really performance-sensitive code, exceptions are usually the best and cleanest way to deal with error conditions that aren't bugs. If nothrow were the default, either we'd have to slap whatever the equivalent of !nothrow would be all over the place, or exceptions would be seriously compromised as a means of error handling.

- Jonathan M Davis



January 04, 2020
On Saturday, 4 January 2020 at 16:05:10 UTC, Steven Schveighoffer wrote:
> What do you put if you throw? @safe by default has alternatives. nothrow does not. Are we going to get a new keyword/uda?

Walter's current plan seems to be allowing the `throw` keyword to be used as an attribute.

https://github.com/dlang/DIPs/pull/167/files

That still leaves the question how @nogc and pure will be negated, and how to specify the default attributes for a module without affecting template functions and functions with `auto` return-type.
January 04, 2020
On Saturday, 4 January 2020 at 20:53:34 UTC, Dennis wrote:
> Walter's current plan seems to be allowing the `throw` keyword to be used as an attribute.
>
> https://github.com/dlang/DIPs/pull/167/files

that looks good to me btw. I'm against the default change but that DIP appears to do what I'd want - the negating behavior is also well done.

> That still leaves the question how @nogc and pure will be negated, and how to specify the default attributes for a module without affecting template functions and functions with `auto` return-type.

lol we could always use existing keywords like crazy:

pure!false
@nogc!true
nothrow!default
virtual!false

or something similar.

gotta love the double negatives but meh. throw already being a keyword is convenient. pure is already positive so convenient. just @nogc, the odd one out.

but like regardless i wouldn't oppose such a thing.

i also wouldn't oppose impure and @gc keywords added.


I also wouldn't oppose templates simply not being affected by scope-level keyword attributes. That might be a winner actually.... maybe. If you want it to apply to the template, you'd just have to explicitly write it again. They get special case because of the inference rule.

Could also mean

@safe class Foo {
   final void my_template()(); // actually inferred, despite outer @safe
}


idk, just throwing out ideas. To be honest I'd take just about *anything* that actually happens now over some other idea that we have to wait several years for again.
January 04, 2020
On Saturday, 4 January 2020 at 21:07:03 UTC, Adam D. Ruppe wrote:
> lol we could always use existing keywords like crazy:
>
> pure!false
> @nogc!true
> nothrow!default
> virtual!false
>
> or something similar.
>
> gotta love the double negatives but meh. throw already being a keyword is convenient. pure is already positive so convenient. just @nogc, the odd one out.

So do you allow `nothrow!false` as well? Or:
- nothrow!(false)
- nothrow!0
- nothrow!(0 || false)
- throw!false
- throw!true

Also, which one gets put in the tuple when calling:

__traits(getFunctionAttributes, func);

Currently "@system", "@trusted" or "@safe" is always there, while "nothrow", "pure" and "@nogc" are either there or not. What is the canonical way to check that a function does not have the "nothrow" attribute? When there's multiple options, it's bound to be confusing.

It might be bikeshedding over the real issue (which is that it is still impossible to negate these attributes at all), but considering attribute soup is already a common complaint, I don't want it to become worse.
January 04, 2020
On Saturday, 4 January 2020 at 21:07:03 UTC, Adam D. Ruppe wrote:
> [...]
>
> lol we could always use existing keywords like crazy:
>
> pure!false
> @nogc!true
> nothrow!default
> virtual!false
>
> or something similar.

I had this idea too (for my toy language). One potential problem is
@safe/@system/@trusted though, but you could just keep @trusted as a
separate attribute.

> [...]
>
> I also wouldn't oppose templates simply not being affected by scope-level keyword attributes. That might be a winner actually.... maybe. If you want it to apply to the template, you'd just have to explicitly write it again. They get special case because of the inference rule.

This is an interesting idea. How often do you actually want your
templates to be affected by scope-level attributes?

January 04, 2020
On 1/4/2020 8:06 AM, Mike Parker wrote:
> On Saturday, 4 January 2020 at 16:05:10 UTC, Steven Schveighoffer wrote:
>> Just wanted to bring this up, and not muddy the other thread.
>>
>> What do you put if you throw? @safe by default has alternatives. nothrow does not. Are we going to get a new keyword/uda?
>>
>> -Steve
> 
> Seems like we'd have to. Or on/off attribute parameters.

The first step is to add `throw` as a function attribute,

https://github.com/dlang/DIPs/pull/167

The next step will be to make nothrow the default. I have not prepared a DIP for that yet, but will.

The short rationale is that exceptions being a "pay only if you use them" is a complete fraud. They're expensive to support, meaning performance programs use other ways of signalling errors and use nothrow.
« First   ‹ Prev
1 2 3 4 5 6 7 8 9