November 09, 2017
On 11/6/17 12:20, Michael wrote:
> I can't quite see why this proposal is such a big deal to people - as
> has been restated, it's just a quick change in the parser for a slight
> contraction in the code, and nothing language-breaking, it's not a big
> change to the language at all.
>
> On Monday, 6 November 2017 at 19:13:59 UTC, Adam Wilson wrote:
>> I am all for the Elvis operator, however I have two reservations about
>> it. The first is that I don't see much use for it without a
>> null-conditional. The second is that the current proposed syntax ?: is
>> MUCH to easily confused with ?.
>>
>> This is not easy to read: obj1?.obj2?.prop3?:constant.
>>
>> When designing syntax sugar, ergonomics are very important, otherwise
>> people won't use it. Microsoft spent a LOT of time and treasure to
>> learn these lessons for us. I see no reason to ignore them just
>> because "we don't like Microsoft"
>>
>> My proposal would be to copy what MSFT did, expect that I would I
>> would introduce both operators at the same time.
>>
>> Syntax as follows: obj1?.obj2?.prop3 ?? constant
>>
>> In practice I don't see much use of the idiom outside of null's. The
>> ONLY other thing that would work there is a boolean field and you
>> might as well just return the boolean itself because the return values
>> have to match types.
>
> I feel this is kind of embellished somewhat. When you write
>
>> This is not easy to read: obj1?.obj2?.prop3?:constant.
>
> you're not separating it out as you do when you write your preferred
> version:
>
>> Syntax as follows: obj1?.obj2?.prop3 ?? constant
>
> How is
>
>> obj1?.obj2?.prop3 ?: constant
>
> not as easy to read as
>
>
>> obj1?.obj2?.prop3 ?? constant
>

You're right, I didn't, that was intentional, because sometimes people write things like that. And it took a while for anyone to say anything about it. That is my point.

But that's the thing. The ?? is significantly more obvious in the condensed version.

This is something that a UX designer would recognize instantly, but human factors are very definitely not our strong skill as engineers. FWIW, my human factors experience comes from the deep study of airline crashes that I do as a pilot.

> to me they are the same in terms of readability, only with ?? you have
> greater chances of mistyping and adding a second ? in there somewhere,
> whereas the ?: is just a contraction of the current syntax, I really
> don't think it's that difficult, so I'm not sure what people's hang-ups
> are, but I don't think the argument that ?? is easier to read than ?:
> holds any weight here, because one *is* a change to the language, and
> the other is a change to the parser and a contraction of a standard
> convention.
>

Two things. ?: is ALSO a change a to language (lexer+parser). As to the whole "it's no more likely to typo the colon than the question" argument, sure, but that depends on the keyboard layout more than anything else, what works for you may not work elsewhere. And in either case, it's an easy compiler error. So you don't win anything with the ?:, but you win readability with the ??. MSFT spends a LOT of time studying these things. It would be wise to learn for free from the money they spent.


-- 
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;
November 10, 2017
On Friday, 10 November 2017 at 05:23:53 UTC, Adam Wilson wrote:
> MSFT spends a LOT of time studying these things. It would be wise to learn for free from the money they spent.

Is that the same company that made Windows 10?
November 10, 2017
On 11/10/17 00:24, codephantom wrote:
> On Friday, 10 November 2017 at 05:23:53 UTC, Adam Wilson wrote:
>> MSFT spends a LOT of time studying these things. It would be wise to
>> learn for free from the money they spent.
>
> Is that the same company that made Windows 10?

And what?

-- 
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;
November 10, 2017
On Friday, 10 November 2017 at 10:24:01 UTC, Adam Wilson wrote:
>
> And what?

This Windows 10.

https://www.youtube.com/watch?v=KHG6fXEba0A

You want us to look the MSFT on how things should be done??


November 10, 2017
On Friday, November 10, 2017 10:36:01 codephantom via Digitalmars-d wrote:
> On Friday, 10 November 2017 at 10:24:01 UTC, Adam Wilson wrote:
> > And what?
>
> This Windows 10.
>
> https://www.youtube.com/watch?v=KHG6fXEba0A
>
> You want us to look the MSFT on how things should be done??

In general, I don't like Microsoft, and I certainly don't like what they've done with Windows post Windows 7, but that doesn't mean that everything they say or do is terrible. Even if some what they do is terrible, there are some really smart people working there, and some of what comes out of there is definitely good. I really don't think that judging the situation with ?: or ?? or any other operator in C# on what's happened with Windows 10 makes any sense. Sure, we're talking about the same company, but we're talking about completely different teams here. And Adam is talking about the research that they've done on the operators in C#, which is completely different from talking about what they've done with a product unrelated to that research.

Shooting down an idea just because it comes from Microsoft (or any other company) rather than judging it on its technical merits is just bad policy. Ideas should be judged based on their own merit, not simply on where they came from.

Based on other posts that you've made, you seem interested in bashing anything related to Windows or Microsoft, and that really isn't productive when we're trying to have a technical discussion.

- Jonathan M Davis

November 10, 2017
On Friday, 10 November 2017 at 10:51:28 UTC, Jonathan M Davis wrote:
merit, not simply on where they came from.
>
> Based on other posts that you've made, you seem interested in bashing anything related to Windows or Microsoft, and that really isn't productive when we're trying to have a technical discussion.
>
> - Jonathan M Davis

yeah..whatever...

maybe try getting a sense of humour..then the discussion might be interesting for a change.

November 10, 2017
On Friday, 10 November 2017 at 10:51:28 UTC, Jonathan M Davis wrote:
> Shooting down an idea just because it comes from Microsoft (or any other company) rather than judging it on its technical merits is just bad policy. Ideas should be judged based on their own merit, not simply on where they came from.
>
> Based on other posts that you've made, you seem interested in bashing anything related to Windows or Microsoft, and that really isn't productive when we're trying to have a technical discussion.
>
> - Jonathan M Davis

and btw. the suggestion that we look to MSFT for how to do things with the D language, deserves (in my opinion), to be treated with humour.

You disagree?

Too bad.
November 10, 2017
On Friday, 10 November 2017 at 08:24:59 UTC, codephantom wrote:
> On Friday, 10 November 2017 at 05:23:53 UTC, Adam Wilson wrote:
>> MSFT spends a LOT of time studying these things. It would be wise to learn for free from the money they spent.
>
> Is that the same company that made Windows 10?

Not just the company, it's the same person who written MSDOS, Win 95, Windows Vista, 7, 8, 8.1, 10 and everything else in M$ because M$ is just one person company with some random guy who can write a thousands lines of code per hour.
November 10, 2017
On Friday, 10 November 2017 at 10:51:28 UTC, Jonathan M Davis wrote:
> we're trying to have a technical discussion.
>
> - Jonathan M Davis

And will someone please tell me, where is technical benefit of putting this crap (?: or ??) into a programming language?

After 8 pages of people rambling on about it, nobody agrees on anything.

And then you have a go at me for trying to bring in some humour?

Wow!
November 10, 2017
On Friday, 10 November 2017 at 11:12:38 UTC, codephantom wrote:
> On Friday, 10 November 2017 at 10:51:28 UTC, Jonathan M Davis wrote:
>> we're trying to have a technical discussion.
>>
>> - Jonathan M Davis
>
> And will someone please tell me, where is technical benefit of putting this crap (?: or ??) into a programming language?
>
> After 8 pages of people rambling on about it, nobody agrees on anything.
>
> And then you have a go at me for trying to bring in some humour?
>
> Wow!

"Technical benefit"
Where is the technical benefit in changing design of web pages or apps? Why windows, Unity, KDE, Gnome or OSX changes their design by ages?

Not everything is about technical benefits. Sometimes it's about better look, better usability or just innovation and bringing something new.


You are judging C#, but looks where is D and where is C#.