flamingo_pinyata@sopuli.xyz to Programmer Humor@programming.dev · 22 hours agoYou can pry pattern matching from my cold dead handssopuli.xyzimagemessage-square163fedilinkarrow-up1407arrow-down114
arrow-up1393arrow-down1imageYou can pry pattern matching from my cold dead handssopuli.xyzflamingo_pinyata@sopuli.xyz to Programmer Humor@programming.dev · 22 hours agomessage-square163fedilink
minus-squarefruitcantfly@programming.devlinkfedilinkarrow-up2·edit-23 hours ago With Rust you safe 1 char, and gain needing to skip a whole line to see what type something is. Honestly, the Rust way of doing things feels much more natural to me. You can read it as Define a function, with the name getoffmylawn, that takes a Lawn argument named lawn, and returns a bool Whereas the C function is read as Do something with a bool? Could be a variable, could be a function, could be a forward declaration of a function, whatever it is, it has the name getoffmylawn, there’s a (, so all options are still on the table, ok, that’ a function, since it takes a Lawn argument named lawn, that returns a bool
Honestly, the Rust way of doing things feels much more natural to me.
You can read it as
getoffmylawn,Lawnargument namedlawn,boolWhereas the C function is read as
bool? Could be a variable, could be a function, could be a forward declaration of a function,getoffmylawn,(, so all options are still on the table,Lawnargument namedlawn, that returns abool