HiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · edit-224 天前Why make it complicated?lemmy.mlimagemessage-square122fedilinkarrow-up1370arrow-down138file-textcross-posted to: [email protected]
arrow-up1332arrow-down1imageWhy make it complicated?lemmy.mlHiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · edit-224 天前message-square122fedilinkfile-textcross-posted to: [email protected]
minus-squareanton@lemmy.blahaj.zonelinkfedilinkarrow-up4·23 天前At least be fair and cut out the .into()
minus-squarenebeker@programming.devlinkfedilinkEnglisharrow-up3·23 天前And bow to the compiler’s whims? I think not! This shouldn’t compile, because .into needs the type from the left side and let needs the type from the right side.
minus-squareHaradion@lemmy.mllinkfedilinkarrow-up2·17 天前If type constraints later in the function let the compiler infer the type, this syntax totally works.
minus-squarenebeker@programming.devlinkfedilinkEnglisharrow-up1·17 天前Like if the variable is then used in a function that only takes one type? Huh.
At least be fair and cut out the
.into()
And bow to the compiler’s whims? I think not!
This shouldn’t compile, because .into needs the type from the left side and let needs the type from the right side.
If type constraints later in the function let the compiler infer the type, this syntax totally works.
Like if the variable is then used in a function that only takes one type? Huh.