|
You have a strange mind nope
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
Means: "I think I know it" ... but I'll give the others a chance, since I'm not setting Mondays.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
It's Friday tomorrow
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
Yeah, but if nobody gets it ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
True
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
I'm trying to create a permanent link to a message. I click the chain icon in the lower right of the message. And then .... nothing. There is nothing in the clipboard to paste! Where is the permalink and how do I get it?
Get me coffee and no one gets hurt!
|
|
|
|
|
The URL changes. Copy and paste it.
|
|
|
|
|
Aaaaaaaaah! Thanks.
Get me coffee and no one gets hurt!
|
|
|
|
|
The simplest option is to right-click the icon and select "copy link".
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Paraphrased from Microsoft's own docs in order to make it readable
MyMethod(options => _ = provider switch
{
"option 1" => options.Method1(x => x.Prop),
"option 2" => options.Method2(x => x.Prop),
_ => throw new Exception($"Unsupported option: {option}")
});
Are we really helping the Art with this type of syntax? I'm trying to work out what we're saving here. Keystrokes? HDD space? Screen real estate?
cheers
Chris Maunder
|
|
|
|
|
Trying to save all the above, show how clever language designers can be, and burn out everyone else's brain cells trying to keep up with, and parse, all this shite.
|
|
|
|
|
Greg Utas wrote: all this shite.
amen
Real programmers use butterflies
|
|
|
|
|
But you understand it!
|
|
|
|
|
Completely agree...
Many of the new features to the Microsoft .NET compilers, to me, are completely unreadable.
This all started with generics and LINQ years ago, when they introduced the caret as a compiler symbol.
With code,they have made it ambiguous while with LINQ, they turned SQL upside down.
What is the purpose of all this? To show that you can make programming as difficult as rocket science?
I never use any of these features and stick with the "old ways" of writing code. It is much easier with little to ambiguity.
So what if you save a few milli-seconds here or there. Who cares?
Steve Naidamast
Sr. Software Engineer
Black Falcon Software, Inc.
blackfalconsoftware@outlook.com
|
|
|
|
|
I really like that you mentioned that.
Just yesterday during a live coding session another dev was showing me how to do a thing.
He used a C# anonymous function / lambda expression and was trying to get it right (and this was his code) and he was typing, backspacing, typing, backspacing...waiting for intellisense, typing waiting for intellisense...
I was like, "yeah, functional programming...no one can remember the syntax..." We both laughed.
I mean regular old OOP and structured programming is really easy to remember and type actually.
*youngster waves fist and starts..."Old man...!!!"
I know.
|
|
|
|
|
raddevus wrote: *youngster waves fist and starts..."Old man...!!!"
... older man smiles silently: APL
Mircea
|
|
|
|
|
In the words of Kernighan - everyone knows that debugging is harder than coding. Therefore if you are being as clever as you can be when writing the code, you will have no chance of debugging it.
|
|
|
|
|
|
That is one reason I never liked to program in Unix. The Programmers wrote code that was that was terrible to understand, even for C programming. Compared to writing C for MS or PC DOS where the code was understandable. I can see why Unix has been called a "write only operating system" and why other coders who read someone else's code will call it crap.
|
|
|
|
|
You can't 'program in Unix', Unix is an operating system not a programming language. The point of compilers is that you can write code that will run on multiple systems. Grep can use the same 'C' code for MSDOS or UNIX or RT11.
|
|
|
|
|
Maybe I'm the odd one out but I don't see the issue. It's an expression syntax instead of a statement syntax. Not to mention this syntax forces an expression as the body of a case section so if your intent is to return something then that is enforced, whereas the statement syntax doesn't care. I feel like it's the same difference and motivations between the ternary operator ?: and if-else. Expression vs statement. Something simple that yields a value vs something possibly complex that may or may not.
Also you save space. 6 lines vs 15 lines
string x = "test";
int y = x switch {
"test" => 0,
"test1" => 1,
"test2" => 2,
_ => 3
};
int z = -1;
switch (x) {
case "test":
z = 0;
break;
case "test1":
z = 1;
break;
case "test2":
z = 2;
break;
default:
z = 3;
break;
};
|
|
|
|
|
Jon McKee wrote: Also you save space. 6 lines vs 15 lines
If it's line count to want to save, you can write:
int z = -1; switch (x) { case "test": z = 0; break; case "test1": z = 1; break; case "test2": z = 2; break; default: z = 3; break; };
Nothing succeeds like a budgie without teeth.
|
|
|
|
|
Readable line counts are what matters. Most software, including the Windows 10 source, could technically be represented on a single line (get wrecked Python nerds ).
Also, and I might be a pedant, but I'd say this
int y = x switch { "test" => 0, "test1" => 1, "test2" => 2, _ => 3 };
is way more readable than this
int z = -1; switch (x) { case "test": z = 0; break; case "test1": z = 1; break; case "test2": z = 2; break; default: z = 3; break; };
since it has fewer columns, reads much like an array initializer syntax which is common in modern languages, and due to the restrictions on the expression syntax the case body is a relatively constant size (a compound scope isn't allowed like with the statement syntax).
modified 11-Jun-21 6:04am.
|
|
|
|
|
Jon McKee wrote: (get wrecked Python nerds )
People who program in Python cannot be classified as nerds. Nerds are smart.
Nothing succeeds like a budgie without teeth.
|
|
|
|
|
I used to feel the same way until IntelliJ IDEA showed me how to reduce a block of code to a single line using similar obscure syntax. (much to my surprise!)
The Lounge[^]
Get me coffee and no one gets hurt!
|
|
|
|