Parsa pfp

Parsa

@parsa

32 Following
68 Followers


Parsa pfp
Parsa
@parsa
At the crossroads of lowering memory usage vs lowering the need for reallocations 😭
1 reply
0 recast
2 reactions

Parsa pfp
Parsa
@parsa
But the one thing that's wrong here is that to evaluate the `|` the rhs is pre-computed before being passed, this does not happen in logical or operator since logical or has a conditional nature and doesn't evaluate the rhs if lhs is 'true'. Which is the same in JavaScript `true || foo()` doesn't invoke foo.
0 reply
0 recast
0 reaction

Parsa pfp
Parsa
@parsa
The allocation is definitely fine, I'm just weird, lol. and the code I shared actually does what it is meant to do; it's just a little ugly to wrap things in a `W` all the time. That's my only issue with it. But honestly, I wish `Option<T> || Option<T>` was a thing supported by default.
0 reply
0 recast
1 reaction

Parsa pfp
Parsa
@parsa
DIG
0 reply
0 recast
1 reaction

Parsa pfp
Parsa
@parsa
don't try this at home lol https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=77cf85062519a3b9827ed0a560aac6c4 (clippy: it's better to use `unwrap_or_else(|| "/bin/sh".to_string())` here to avoid allocating a string object if it's not needed.)
1 reply
0 recast
2 reactions

Parsa pfp
Parsa
@parsa
lol you guys keep count? 🤓
0 reply
0 recast
1 reaction

Parsa pfp
Parsa
@parsa
good point! tnx ❤️
1 reply
0 recast
1 reaction

Parsa pfp
Parsa
@parsa
So excited to be here! Thanks for the invite 🙂
2 replies
0 recast
1 reaction

Parsa pfp
Parsa
@parsa
thank you! still figuring this out :)
1 reply
0 recast
1 reaction

Parsa pfp
Parsa
@parsa
Hello Warp!
2 replies
1 recast
5 reactions