Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
retoor70801d@Liebranca I made my first Rust app yesterday 😕 It works very good 😕 It didn't contain any bug 😕 It wasn't much source 😕 One single sharable binary 😕
But based on what I've seen like if Some ().. C'mon what's next, no cap fr fr are probably functions too. Fr fr -
@retoor It's pattern matching. `if let Some(foo) = maybe_foo {}` matches maybe_foo against Some(foo). E.g. if it's the Some variant it binds the contents to foo
-
retoor70801d@12bitfloat normal devs call that truthy. Any more of such 'new inventions'? But thanks for the help on that yesterday.
-
@retoor It's not truthy because you're extracing values
You can also match against `Some(Some(foo))` or
`MyCoolEnum::VariantA(...)` or even `MyStruct { a: 20, .. }`. The latter only matches when the field is 20 -
@retoor That only works for null (and empty strings I guess)
Here's a cool way to do fizzbuzz using pattern matching
https://play.rust-lang.org//...
Can't do that without pattern matching :P -
retoor70801d@12bitfloat no, why would you :p But did you make that for me? 😍 Aww. I'm really annoyed by not the "%s" in that code tho.
-
@retoor What am I looking at 💀 Most readable C code lol
How does that even work? I thought the format string has to be a literal? 🤔 -
retoor70801d@12bitfloat huh indeed, is that thihg now calling always with the int patam while not having it defined in the first argument? Wtf indeed. But idea is solid.
-
@retoor Huh, it actually works https://godbolt.org/
You learn something new every day :D
Unused params in vararg functions should be fine I think -
Liebranca124119h@retoor Last I tried rustc it didn't likit when I `};`'d all over her face and tits, which ruined the mood for me.
Anyway, it's C++ but worse. Perhaps there's an octopusdog inside all of us. -
retoor708012h@Liebranca I decided to do a small project to do with it. I made project generation AI software. I'm creating that for the rust project. Can't stand the syntax. I'm worried that it's something like react. Something you learn so much weird shit for that you end up with a stockholm syndrome. Do programmers realize that the syntax is to benefit user, not the machine? This is why I consider python one of the best languages ever made and Rudy maybe one of the worst. A new language that is hard... Not very attractive. Compiling it ain't a joke either.
-
Liebranca124111h@retoor rust, specifically, suffers from it's syntax primarily.
I say 'specifically' because any compiler that gives you a high number of features/guarantees is inevitably going to result in the language itself requiring the programmer learn many more concepts to utilize it effectively, to say nothing of the striking increases in compilation time.
But this is true for *many* languages other than C++ and rust, it's a problem inherent to high-level programming in and of itself, in that you're stacking complexity, which leads to the 'befuddling' quality of code -- ie, there's too much shit to keep in your head to fully understand how anything at all works without mind-altering, preferably injectable drugs.
rust syntax, had it learned lessons from the innumerable syntactical idiocies of C++, would be a lot better off. However, the language leans on and propagates said intellectual failures of humanity, resulting in its decisive failure to fulfil the promise of replacing C and C++. -
12bitfloat1058110h@Liebranca tf are you talking about. Rust did learn from c++, thats why it doesnt look outdated with 5 different ways of doing the same thing
-
@retoor They are all different for different usecases. Remember, Rust is a systems lang!
str -> std::string_view
String -> std::string with utf8 guarentee
OsStr/OsString -> no utf8 guarentee because filenames/envvars might not be utf8
CStr/CString -> no interior null bytes and are null terminated for C interop -
@retoor Makes sense. The other types are only useful in certain areas (e.g. dealing with the os, like paths)
-
@12bitfloat Pardon, you did not learn how to read.
"[rust syntax], had it learned lessons from the innumerable syntactical idiocies of C++, would be a lot better off."
7mar. -
@Liebranca Please enlighten me what syntax Rust has taken from C++ instead of learning from it
Because the answer is literally nothing. Rust doesn't look like C++ at all nor does it have the syntactical issues that C++ has. For starters, Rust's syntax is context free -
@Liebranca I think you're just a retarded hater with no actual arguments, which isn't surprising considering you likely have never written 10 lines of rust code
Of course you don't like it. You have zero clue how it works or what it does -
@Liebranca Also, bro, 75% of your github projects are C++ and Perl. Fucking perl of all things. And this man is criticising syntax
...yeah okay. Guess we just have *very* different preferences ;P -
@Liebranca Which is good because they have horrible syntax, none of which landed in Rust
Gimme an example of bad rust syntax and what your critique of it is -
@12bitfloat
macro_rules! forward {
( $( $fn:ident( $($param:ident: $ty:ty),* ) $( -> $ret:ty)? ),+ $(,)? ) => {
impl Build {
$( fn $fn(&self, $($param: $ty),* ) $( -> $ret)? {
self.config.$fn( $($param),* )
} )+
}
}
}
src: https://github.com/rust-lang/rust/...
Critique: It's shit.
Another question? -
@Liebranca Declarative macros is such a copout answer. Nobody writes them on a daily basis and they barely even qualify as "Rust syntax" (more like a preprocessor)
Even then, tell me how to improve it. How would a Liebranca approved declarative macro system look like, that has the same power as Rust's current syntax?
Let me have a guess, it'll look pretty much the same because that's just how declarative macros work -
@Liebranca Oh yeah and how is that in any way related to C++?
It's a feature C++ doesn't even have, and the only thing you could criticise. Hundreds of thousands of lines of Rust code: ifs, whiles, structs, traits and you couldn't find one example there to criticise....
Wonder why
Consider,
```
namespace A;
macro m00 a,b;
··display a,b;
end macro;
macro m01 a;
··m00 a,$0A;
end macro;
m01 $24;
end namespace;
```
OUT: $0A24 ("$\n").
Ah, but you just HAD to fuck me in the ass, didncha fasm2? Initializing anal bleeding:
```
namespace B;
A.m01 $24;
end namespace;
```
OUT: illegal instruction 'm00'.
Explanation: macros carry no context, and so 'm00' is unreachable from 'B' namespace.
Could I maybe write a code-capture macro to generate a wrapper that resets the namespace? Yes, and in fact, I did; brilliant exercise in mystical mindfuckery.
But why try so hard? Just pass the fucking ref, like a MAN.
EXPLICIT CTX, BITCH.
```
define @CAS $non; current addressing space
define %ICE @CAS;
macro self:PA&; recursive macro, uuuh spooky-spooky
··match ice , %ICE;
····; self->proc(args)
····match =-=> proc (args) , PA;
······path.proc ice,args; pass ref and args
····; ^self->proc()
····else match =-=> proc () , PA;
······path.proc ice; pass ref only
····; ^sneaky sneaky. set current context when self ctx;
····else match cas , @CAS;
······%ICE equ cas.PA;
····end match;
··end match;
end macro;
```
ALL TOGETHER NOW
```
namespace A;
macro m00 ice,a,b;
··display a,b;
end macro;
macro m01 ice,a;
··self->m00(a,$0A); could also be 'ice.m00 ice,a,$0A' lmao
end macro;
end namespace;
namespace B;
self A; set ice
self->m01($24);
restore %ICE; back to previous
end namespace;
```
OUT: $0A24 ("$\n").
A-há, now **I** got you from behind motherfucker!
Final note: this is 100% perl DNA seeping through the cracks of my sanity and into a fresh fasm2 framework. Why? Dingle-dongle-jungle-berries, that's why. Also crack.
Have a nice wallop.
rant
recursive virtual constexpr sodomy