r/ProgrammerHumor • • Aug 01 '22

>>>print(“Hello, World!”)

Post image
60.8k Upvotes

5.7k comments sorted by

View all comments

2.6k

u/corner-case Aug 01 '22
Record record = new Record().record();

3.6k

u/a-slice-of-toast Aug 01 '22

creates a new record, obviously

1.6k

u/hampshirebrony Aug 01 '22

And was outdated by CD cd = new CD().cd(), which itself was outdated by MP3 mp3 = new MP3().mp3()

206

u/[deleted] Aug 01 '22

[removed] — view removed comment

12

u/shekurika Aug 01 '22

recently had new(()=>new()) in my code x)

6

u/PrevAccLocked Aug 01 '22

Context please?

8

u/shekurika Aug 01 '22

generic that wanted an initalizer function. was meant to be about "VS complains about adding the type in new()" buut I answered to the wrong comment, whoops

23

u/QuestionableSarcasm Aug 01 '22

.net doesn't want you to do anything

not even c#, visual studio or anyone wants you to do it this way or the other way

set up your .editorconfig as you like it and make warnings (or errors, if you prefer), style suggestions and refactoring suggestions to actually mean something

4

u/[deleted] Aug 01 '22

[removed] — view removed comment

5

u/AdamiralProudmore Aug 01 '22

Actually those suggestions come from the Roslyn Analyzers made by the .NET team (the same things that provide intellisense). So you are in both technical and general senses correct in saying "that is what .NET wants".

→ More replies (4)

4

u/MrAmos123 Aug 01 '22

.NET Core prefers the second, I think, due to the use of var. Though, it's likely more to do with the IDE.

Using Rider, if you write Record record = new Record(); Rider wants to replace the first Record with var.

→ More replies (2)

3

u/[deleted] Aug 01 '22

This is the way

→ More replies (3)

8

u/[deleted] Aug 01 '22

Except hipsters still use Record record = new Record(); and swear everything else is just not the same.

3

u/ushu3323 Aug 01 '22

Just use Template pattern

→ More replies (13)

18

u/LordSalem Aug 01 '22

No, it records a new record

→ More replies (8)

13

u/insta Aug 01 '22

buffalo buffalo buffalo buffalo buffalo

→ More replies (1)

9

u/graygray97 Aug 01 '22

Record record = new Record().record();

Is record a record in this?

Also why stop there:
Record record = new Record().record().record().record().record().record();
We could go on forever

5

u/Ruby_Bliel Aug 02 '22

I raise you:

auto record {std::make_unique<Record>(&Record::record)};

At first I thought you were passing a function to new, which looked kinda nuts. Gave me the idea to pass a pointer to a static member function in the object you're constructing into the constructor. Not exactly subtle in its ill-formed-ness.

4

u/GamerNumba100 Aug 02 '22

Creates “record,” an object of type “Record,” which then stores an instance; that instance is created through a call of the Record() function, which creates an object, and that object’s function called “record()” is called, and it returns an instance of Record that is then stored.

4

u/DeepLock8808 Aug 02 '22

Records a record, and that new record is named “Record”

3

u/_-__________ Aug 02 '22

I hate Java

2

u/Horny_Trans_Gal Aug 02 '22

Yo isn't that how they make Guinness world records?

→ More replies (16)