Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Tuesday, 8 February 2022 at 02:57:29 UTC, forkit wrote: I would prefer @must_use over @mustUse, for example (althouhgh i prefer @mustuse to both of these, since the underscore is not really needed in this case). my argument for the above, is: The problem with using camelCase on @attributes, is that it implies nothing special about it (the attribute), at all. It is common practice to use camelCase for things like variables, function names, etc... i.e. things that hold something, or do something. Whereas an @attribute is essentially a predicate. You are proclaiming a static declaration, that will apply to what follows. As such, it deserves to stand out, with a different naming convention. That is: all @lowercase, but when required, @snake_case.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On 2/7/2022 6:21 PM, Paul Backus wrote: On Monday, 7 February 2022 at 23:40:38 UTC, Walter Bright wrote: On 2/6/2022 9:05 PM, forkit wrote: only to have the compiler complain, that its' actually @mustUse I have to agree. All D keywords and imports and compiler-recognized attributes are lower case, @mustuse should be consistent with that. I guess core.attribute.gnuAbiTag sneaked in behind your back, huh? Indeed it did. I did not notice it until this moment. A lot of people work on D, and I have to trust them. Anyway, I'm happy to change it if that's your call, although it would have been nice to have caught this before the DIP was officially accepted. Yes, please change it. Thank you!
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Tuesday, 8 February 2022 at 02:21:37 UTC, Paul Backus wrote: I guess core.attribute.gnuAbiTag sneaked in behind your back, huh? Anyway, I'm happy to change it if that's your call, although it would have been nice to have caught this before the DIP was officially accepted. actually, I wish camelCase was not a requirement of user defined attributes. I would prefer @must_use over @mustUse, for example (althouhgh i prefer @mustuse to both of these, since the underscore is not really needed in this case). Don't be discouraged though, the proposal is sound. But ideas that might help it become more acceptable to programmers (and the langauge), is still not worthy of being excluded from discussion (I think I got enough negations in there ;-)
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Tuesday, 8 February 2022 at 01:53:17 UTC, forkit wrote: also, the use of the word 'must' in any programming language, needs careful consideration. 'mustuse' has the potential to invite mass 'mustuse' demonstrations! 'nodiscard' suggests somewhat more 'autonomy', and would achieve a more-or-less similiar outcome.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Monday, 7 February 2022 at 23:40:38 UTC, Walter Bright wrote: On 2/6/2022 9:05 PM, forkit wrote: only to have the compiler complain, that its' actually @mustUse I have to agree. All D keywords and imports and compiler-recognized attributes are lower case, @mustuse should be consistent with that. I guess core.attribute.gnuAbiTag sneaked in behind your back, huh? Anyway, I'm happy to change it if that's your call, although it would have been nice to have caught this before the DIP was officially accepted.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Tuesday, 8 February 2022 at 01:40:38 UTC, forkit wrote: I often say to my cat 'what are you doing' .. but what i really mean is 'don't do that'. by avoiding negation, I'm probably just confusing my cat as to what i really meant. mustuse -> I must use it? Why must i use it? How must I use it? What happens if i don't use it. nodiscard -> don't discard it. nice and simple (just like 'don't do that'). I guess the question really is: What it the most important concept you are relaying to the programmer by the use of that term? That they 'must use it'. Or, that they 'cannot discard it'. They seem like two different concepts to me. I don't believe that using nodiscard in C++, means you must use it. If in D, it means you must use it, then 'mustuse' makes more sense. If not, then stick with what people already know, is my advice.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Tuesday, 8 February 2022 at 01:25:52 UTC, Walter Bright wrote: Sorry, all those negations made my brain explode. P.S. English has examples of negation issues, such as: "I could care less." which makes no sense at all, until you realize it's just a shortened version of "I couldn't care less." The addition or subtraction of the negation does not change the meaning, as the brain doesn't do a good job recognizing it. The phrases "not no-way", and "not no-how" use multiple negations to emphasize, rather than negate. I often say to my cat 'what are you doing' .. but what i really mean is 'don't do that'. by avoiding negation, I'm probably just confusing my cat as to what i really meant. mustuse -> I must use it? Why must i use it? How must I use it? What happens if i don't use it. nodiscard -> don't discard it. nice and simple (just like 'don't do that').
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On 2/6/2022 7:14 AM, Daniel N wrote: However by choosing "use" we could avoid the entire discussion about which case to use... "mustuse" is much more greppable.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On 2/7/2022 5:10 PM, forkit wrote: Suppose I don't want to 'use it'. That should be allowed, as long as I don't discard it. With mustuse, I'm being told I can't discard it, and that i must use it. Sorry, all those negations made my brain explode. P.S. English has examples of negation issues, such as: "I could care less." which makes no sense at all, until you realize it's just a shortened version of "I couldn't care less." The addition or subtraction of the negation does not change the meaning, as the brain doesn't do a good job recognizing it. The phrases "not no-way", and "not no-how" use multiple negations to emphasize, rather than negate.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Monday, 7 February 2022 at 23:38:11 UTC, Walter Bright wrote: Anytime you find yourself writing not-nohow, not-noway, etc., it's time to redesign the state of the variables. Try to organize logic so ! is not necessary. I mean, try to organize logic so ! is absent. But sometimes that requires too much effort ;-) e.g. !debug { do this } My brain decided this form of logic without me really thinking at all. Now I have to 'rethink', in order to find the correct form of that logic that doesn't require the use of ! nodiscard is better than mustuse for the same reason. Suppose I don't want to 'use it'. That should be allowed, as long as I don't discard it. With mustuse, I'm being told I can't discard it, and that i must use it.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Monday, 7 February 2022 at 23:38:11 UTC, Walter Bright wrote: Andrei once asked me for scientific evidence that negations are cognitively more difficult for human brains to understand. I didn't have it at the time, but did eventually find it and forwarded it to Andrei, who was satisfied with it. I didn't keep a copy, though. It's not just my opinion that negations are to be avoided, there's research justifying it. .. I certainly don't discount such research. However, I expect there is also research that says something different ;-) Also, I expect you're talking about linguistics, and not programming languages. Truths may hold in one, and not other. Regardless, the research I am familiar with, tells me that we are psychologically biased towards cognitive schemas that we already hold. Changing ones cognitive schemas is not effortless, and, since D is very much focused on attracting programmers from the C++ world, the existing schemas those users hold should always be factored into ones thinking when implementing change in D.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On 2/6/2022 9:05 PM, forkit wrote: only to have the compiler complain, that its' actually @mustUse I have to agree. All D keywords and imports and compiler-recognized attributes are lower case, @mustuse should be consistent with that.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On 2/6/2022 7:17 AM, Paul Backus wrote: To be honest, though, I can see where he's coming from. When writing DIP 1038, I made a conscious effort to avoid using the term "non-`@nodiscard`", due to the double negative. With a positively-phrased name like `@mustUse`, that problem disappears. Andrei once asked me for scientific evidence that negations are cognitively more difficult for human brains to understand. I didn't have it at the time, but did eventually find it and forwarded it to Andrei, who was satisfied with it. I didn't keep a copy, though. It's not just my opinion that negations are to be avoided, there's research justifying it. I remember back in the olden daze when I was designing digital logic circuits that using NAND and NOR gates would cause me endless confusion. I eventually decided to design with AND and OR gates, then mechanically convert them to NAND and NOR using deMorgan's Theorem. NANDs and NORs require fewer transistors to function, so are preferred. This was later built into the ABEL programming language that I designed for Data I/O. ABEL was used to burn logic equations into programmable logic devices. It had a pass that converted everything to NANDs and NORs. Positive logic in computer code, however, has no such penalty. Hence I try to write code that eschews negative logic. Anytime you find yourself writing not-nohow, not-noway, etc., it's time to redesign the state of the variables. Try to organize logic so ! is not necessary. I mean, try to organize logic so ! is absent.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Monday, 7 February 2022 at 13:55:40 UTC, Paul Backus wrote: I've seen similar sentiments expressed many times before, in other contexts. Every time, there are some who insist that the new name will never feel natural to them, and they will never let go of the old name. And every time, history proves them wrong. The fact is, human brains are quite plastic and adaptable. You'll get used to @mustUse, just like I did, and so will everyone else. First, I'm not 'insisting' on anything. I'm just expressing a view. nodiscard is already used by more programmers that D is likely to ever adopt. Indeed, it's these programmers that D is trying to adopt. I'm not sure forcing such people to adapt is necessarily the right approach. that is my point. it's not necessary. you making it necessary ;-)
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Monday, 7 February 2022 at 05:12:39 UTC, forkit wrote: no amount of replies will change anything ;-) .. people will still 'think' @nodiscard, but have to 'remember' it's actually @mustuse, but oops.. no... it's @mustUse.. I do not expect anything from my feedback ;-) .. I'm just saying..humans are humans.. I've seen similar sentiments expressed many times before, in other contexts. Every time, there are some who insist that the new name will never feel natural to them, and they will never let go of the old name. And every time, history proves them wrong. The fact is, human brains are quite plastic and adaptable. You'll get used to @mustUse, just like I did, and so will everyone else.
Re: DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted
On Monday, 7 February 2022 at 05:09:23 UTC, Paul Backus wrote: On Monday, 7 February 2022 at 05:05:27 UTC, forkit wrote: my only concern is the capital U, in @mustUse This seems a little inconsistent with current attributes?? e.g: nogc nothrow inout https://dlang.org/spec/attribute.html also, nodiscard would actually seem more logical, given the above as well. I bet you, people will be thinking nodiscard, but will have to remember to type, @mustuse, only to have the compiler complain, that its' actually @mustUse See my previous replies on this topic: https://forum.dlang.org/post/xgdwevkxqapljcvyj...@forum.dlang.org https://forum.dlang.org/post/yxoinjtarkuotnlnc...@forum.dlang.org This is one of those cases where I think there should be an exception to the "rule" you so blindly want to follow. @mustuse is so much better and makes code so much more consistent.