mirror of
https://github.com/Pagwin-Fedora/website.git
synced 2025-07-18 04:55:42 +00:00
seems complete
This commit is contained in:
parent
aa8ec4c8d8
commit
34ab0de0f5
1 changed files with 7 additions and 16 deletions
|
@ -34,13 +34,13 @@ But I haven't made any arguments for my position yet I've just specified how you
|
|||
//why a 128 bit integer and not just a 64 bit? Well because I wanted to show off that rust has that that's why
|
||||
enum OurEnum{InterviewQuestion(bool), FastFoodOrder(u128), Other(Box<dyn Display>)}
|
||||
fn anything(something:OurEnum)->String{
|
||||
match OurEnum{
|
||||
InterviewQuestion(true)=>{
|
||||
"fizz"
|
||||
},
|
||||
InterviewQuestion(false) => {
|
||||
"buzz"
|
||||
}
|
||||
match OurEnum{
|
||||
InterviewQuestion(true)=>{
|
||||
"fizz"
|
||||
},
|
||||
InterviewQuestion(false) => {
|
||||
"buzz"
|
||||
}
|
||||
FastFoodOrder(size_index) => {
|
||||
if size_index < 10 {
|
||||
"smol"
|
||||
|
@ -96,15 +96,6 @@ But arguments/discussions aren't one sided like that and I chatted with the pers
|
|||
## If the type fits you should accept it
|
||||
This is a rebuke to my "Oh hey I implement your interface now, fuck you" and is simply asking how that's a problem. After all the interface should specify what you need from some data type to be able to use it in some application. This also moves the control flow of which code to run outside of the method taking in data. Combined with the idea that the interface setup can also give compiler errors where it makes sense the question has to be now be asked why are rust enums preferable?
|
||||
|
||||
##,McDonald's?self-document,,,,issome datatypes mayits
|
||||
|
||||
## Is how I would've ended it
|
||||
|
||||
But arguments/discussions aren't one sided like that and I chatted with the person shortly after writing this article and they made an interesting point.
|
||||
|
||||
## If the type fits you should accept it
|
||||
This is a rebuke to my "Oh hey I implement your interface now, fuck you" and is simply asking how that's a problem. After all the interface should specify what you need from some data type to be able to use it in some application. This also moves the control flow of which code to run outside of the method taking in data. Combined with the idea that the interface setup can also give compiler errors where it makes sense the question has to be now be asked why are rust enums preferable?
|
||||
|
||||
## welll uuuuuuuuuuuuh
|
||||
When you have a finite number of states which may contain state within themselves and aren't just representing different input types they're pretty nice.
|
||||
|
||||
|
|
Loading…
Reference in a new issue