I can see how this may be useful. My understanding is that this is go lang and the person created a wrapper type UUID and this function takes the go standard library uuid.UUID and returns the wrapped UUID.
The wrapped UUID could be useful as you can then define methods for it like toInt() or something to make it implement some ID interface you have set up. It's a common pattern in go to create a thin wrapper around an imported type so you can implement all the methods required for some interface you defined. It does make naming those thin wrappers hard because what are you supposed to name the struct that just contains a uuid?
A colleague wrote Java style Python. SomethingDispatcher().dispatch() all the way. It's a mess. Poor guy was thrown into the deep end and left alone for a year. I don't blame him for the outcome.
Meanwhile, functools.partial is one of my favorite tools. I wrote a whole SCADA system in which the initialization just builds data pathways using functools.partial so that incoming event callbacks can be handled with all necessary resources already in scope. Any missing data is made apparent at init, not at event time. It's fast and stable (and I'm pretty proud of it lol).
39 Comments
whimsy@lemmy.zip · 54 pts · 319d
Semantic satiation. Or whatever it's called, i think ive officially lost it after reading this
bytesonbike@discuss.online · 5 pts · 319d
I read the code like half a dozen times and my brain hurts.
18107@aussie.zone · 47 pts · 319d
Is "main" a valid Java identifier?
::: spoiler yes
:::
Hupf@feddit.org · 22 pts · 319d
luciferofastora@feddit.org · 20 pts · 319d
Who hurt you?
rikudou@lemmings.world · 18 pts · 319d
Main, obviously.
killeronthecorner@lemmy.world · 3 pts · 319d
This is your main on drugs 🍳
UnderpantsWeevil@lemmy.world · 41 pts · 319d
UwUID
Not_mikey@lemmy.dbzer0.com · 22 pts · 319d
I can see how this may be useful. My understanding is that this is go lang and the person created a wrapper type
UUIDand this function takes the go standard libraryuuid.UUIDand returns the wrappedUUID.The wrapped
UUIDcould be useful as you can then define methods for it liketoInt()or something to make it implement someIDinterface you have set up. It's a common pattern in go to create a thin wrapper around an imported type so you can implement all the methods required for some interface you defined. It does make naming those thin wrappers hard because what are you supposed to name the struct that just contains a uuid?rikudou@lemmings.world · 17 pts · 319d
Yep, that person would be me and that's exactly what I was doing, just found it funny that there was so many uuids in the piece of code.
Originally the function was named
FromUuidbut I couldn't resist renaming it to make it even better.ByteJunk@lemmy.world · 6 pts · 319d
Clearly, the answer is uuid.
PattyMcB@lemmy.world · 22 pts · 319d
Where did i put that Spiderman x3 pointing meme?
HakunaHafada@lemmy.dbzer0.com · 21 pts · 319d
UwUIDs
mushroommunk@lemmy.today · 19 pts · 319d
When you get a new boss at Twitter who ranks people by lines of code written
jbrains@sh.itjust.works · 19 pts · 319d
New Dutch programming language just dropped.
captain_aggravated@sh.itjust.works · 10 pts · 319d
I've read so many tutorials like this. func Func Myfunc()
If you write textbooks like this you and your family should be boiled in sewage.
ExperimentalGuy@programming.dev · 9 pts · 319d
Why I love the Into trait in rust
fubarx@lemmy.world · 7 pts · 319d
If this was C:
boonhet@sopuli.xyz · 4 pts · 319d
#define satan fubarx
Lemminary@lemmy.world · 2 pts · 319d
:3
01189998819991197253@infosec.pub · 5 pts · 318d
Plot twist: it returns the bios serial.
paequ2@lemmy.today · 4 pts · 319d
Not exactly the same, but this reminded me of the MuffinMail.MuffinHash.MuffinHash talk: https://www.youtube.com/watch?v=o9pEzgHorH0
Randelung@lemmy.world · 1 pts · 319d
A colleague wrote Java style Python. SomethingDispatcher().dispatch() all the way. It's a mess. Poor guy was thrown into the deep end and left alone for a year. I don't blame him for the outcome.
Meanwhile, functools.partial is one of my favorite tools. I wrote a whole SCADA system in which the initialization just builds data pathways using functools.partial so that incoming event callbacks can be handled with all necessary resources already in scope. Any missing data is made apparent at init, not at event time. It's fast and stable (and I'm pretty proud of it lol).
Cevilia@lemmy.blahaj.zone · 4 pts · 319d
irelephant@lemmy.dbzer0.com · 10 pts · 319d
Cevilia@lemmy.blahaj.zone · 4 pts · 319d
mere@lemmy.blahaj.zone · 1 pts · 316d
are you from the UK by any chance
Cevilia@lemmy.blahaj.zone · 1 pts · 316d
mere@lemmy.blahaj.zone · 1 pts · 313d
same - i think it's because the image is blocked in the UK because of the online safety act. Try using a VPN and see if that helps
Cevilia@lemmy.blahaj.zone · 2 pts · 313d
mere@lemmy.blahaj.zone · 1 pts · 311d
omfg of course, classic $BIG_CORP$ stuff
carrylex@lemmy.world · 4 pts · 318d
HeyThisIsntTheYMCA@lemmy.world · 3 pts · 318d
i've now read UUID so many times i'm starting to think it's some kind of sex disease
rikudou@lemmings.world · 2 pts · 318d
That must one awkward conversation... "Can you explain where did you get the uuid from?"
HeyThisIsntTheYMCA@lemmy.world · 1 pts · 318d
i told you last logic loop NO
xoggy@programming.dev · 3 pts · 318d
The feeling you get when searching your codebase for references to your "uid" variable but this cheeky boy keeps popping up.
cbazero@programming.dev · 4 pts · 318d
n, n, n, nn, nnnnnnnnnnnnnnnnnnn, n, nn, n, n,n ....
MonkderVierte@lemmy.zip · 2 pts · 319d
https://makimo.com/blog/scientific-perspective-on-naming-in-programming/
tdawg@lemmy.world · 1 pts · 319d
My coworkers also introduce needless additions to the call stack
four@lemmy.zip · 1 pts · 319d
Shouldnt it be
return UUID { uuid: uuid.uuid }?I think it would make more sense AND more uuid per UUID
rikudou@lemmings.world · 3 pts · 319d
The first UUID is a local type, the second is the name of an embedded struct, the third is the name of the variable.
The struct looks something like this (writing this on my phone)
type UUID struct { uuid.UUID }
So, basically, this is a custom wrapper for a third party UUID implementation.
four@lemmy.zip · 1 pts · 319d
Ahh, that makes sense then
boonhet@sopuli.xyz · 1 pts · 319d
I'm assuming it's a map/dictionary notation here, rather than a type hint