▲ 518 ▼ You can pry pattern matching from my cold dead hands (europe.pub) submitted 10 months ago by flamingo_pinyata@sopuli.xyz to c/programmer_humor@programming.dev 222 comments fedilink hide all child comments
[–] wewbull@feddit.uk -3 points 10 months ago (1 child) What language are they then? They're not Python, JS, permalink fedilink source parent hideshow 1 child comment replies: [–] calcopiritus@lemmy.world 7 points 10 months ago You used macro_rules, which is not common at all. Most rust files don't contain any macro definition. This code doesn't even compile. There is a random function definition, and then there are loose statements not inside any code block. The loop is also annotated, which is not common at all, and when loops are annotated it's a blessing for readability. Additionally, the loop (+annotation) is indented for some reason. And the loop doesn't contain any codeblock. Just an opening bracket. Also, the function definition contains a lifetime annotation. While they are not uncommon, I wouldn't say the average rust function contains them. Of course their frequency changes a lot depending on context, but in my experience most functions I write/read don't have lifetime annotations at all. Yes, what you wrote somewhat resembles rust. But it is in no way average rust code. permalink fedilink source parent
[–] calcopiritus@lemmy.world 7 points 10 months ago You used macro_rules, which is not common at all. Most rust files don't contain any macro definition. This code doesn't even compile. There is a random function definition, and then there are loose statements not inside any code block. The loop is also annotated, which is not common at all, and when loops are annotated it's a blessing for readability. Additionally, the loop (+annotation) is indented for some reason. And the loop doesn't contain any codeblock. Just an opening bracket. Also, the function definition contains a lifetime annotation. While they are not uncommon, I wouldn't say the average rust function contains them. Of course their frequency changes a lot depending on context, but in my experience most functions I write/read don't have lifetime annotations at all. Yes, what you wrote somewhat resembles rust. But it is in no way average rust code. permalink fedilink source parent