[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: 35476235.png (525 KB, 2076x1118)
525 KB
525 KB PNG
HOLY BEAUTIFUL
>>
File: Image 1.jpg (396 KB, 1536x2048)
396 KB
396 KB JPG
>>107624959
fucking disgusting
>>
>>107624959
I'll take that over C++ https://www.youtube.com/watch?v=7fGB-hjc2Gc
>>
>>107624959
actually you aren't supposed to use Option<T> everywhere. it is horribly written, I refuse to believe that it wasn't possible to get rid of at least some of them
>>
>>107624959
>Some

Fuck that.

>>107625189
https://www.youtube.com/watch?v=YR5WdGrpoug
>>
>>107625196
>https://www.youtube.com/watch?v=YR5WdGrpoug
I ain't watching a 1 hour video as an answer on a two sentence post
>>
>>107625189
it's okay that get_user() returns a Some<User> but everything inside the user should just have default values set and not be nullable
>>
>>107625250
yes, that's what I'm talking about. you should make bad states irrepresentable when it's possible. using Option where it's not needed is like using a signed integer to represent an inherently unsigned value
>>
>>107624959
Why not use constructors/From instead of nested literals like this?
You could even just 4 let statements to reduce lines or code and clutter.
>>
>>107625227
Rich Hickey is fantastic. Basically he's again Optional<> fanatism.
>>
>>107625330
Oh, this is match, not a builder.
Use ? then.
>>
>>107625338
>Basically he's again Optional<> fanatism.

well, Option<> is just a tool. sometimes having an entire error type for a proper Result<> is redundant, that's when you are supposed to use it. but it really seems like sometimes people just use it everywhere and at the end you have to make tons of unnecessary checks. generally, I'd say that the general idea from this https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/ article applies here (even though it's about haskell)



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.