[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Why is this allowed?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 46
Thread images: 4

File: 11.png (77KB, 943x710px) Image search: [Google]
11.png
77KB, 943x710px
Why is this allowed?
>>
                                done
done
fi
;;
esac
fi
fi
done
fi
>>
)))))))
>>
>>59702892
what's wrong? it just werks
>>
It's not bad yet. Still almost understandable.
>>
>>59702892
>doing this
>not just writing
print "}*7"
>>
Was finishing up a group uni project the day before the deadline this week, wrote this:
()));});
>>
Python doesn't have this problem :^)
>>
>>59703010
But it does unless you're not defining anything and not using any loops within loops.
>>
>>59702892
FUCK YOU! FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK YOU!
>>
>>59702972
I haven't done any programming in years, but wouldn't that just write to the terminal should the loop before it be closed? That's another function, it doesn't close loops, right? At least if it's C++.
>>
>>59703040
Fucking millenials
>>
Move some of the code into separate methods
>>
>>59703021
Python doesn't have curly brackets around code blocks.
So no, Python really does not have this "problem".
>>
>>59702892
Nice font rendering though
>>
Instead of doing
if (x) {
do_something();
if (y) {
do_sth_else();
}
}

do it like
if (!x)
return;

do_something();
if (!y)
return;

do_sth_else();
>>
>>59703135
So, how would that deal with elseif?
>>
>>59703135
Don't do this.
>>
>>59702921
>>59702933
>>59702972
>>59702973
>>59703135
Javascript masterrace coming through.
>>
>>59703093
I was b8ing m8. Even though python wouldn't have the trailing curly brackets, it would still be a code smell, since indentations that deep are good indicators, that code needs to be refactored.
>>
>>59703171
if (!x) {
do_else_case();
return;
}
do_normal_case();
>>
File: indents.jpg (14KB, 512x118px) Image search: [Google]
indents.jpg
14KB, 512x118px
>>59703198
Yup, that's 28 spaces there, or 14 levels of indentation.

Alternatively:
);}));};})());};
>>
>>59702892
I try to avoid it, but some algorithms REQUIRE 4+ nested loops in order to remain readable and if you don't want to resort to significant whitespace in your language, you need a closing brace character.
>>
>>59705469
You could also use closing keywords, but that wouldn't really change aynthing.
>>
>>59702892
You can easily fix that with an autoformatting plugin.

>write sloppy code
>run plugin
>BOOM! Everything looks neat and properly formatted.
>>
>>59703010
I'd rather deal with a bunch of curly brackets than having to deal with problems fixing white spaces and indentation in order to make Python work.
>>
It's an inevitability. You could try to add some functions to reduce clutter.
>>
>>59703135
No, you should never indent controlled statements without surrounding them with brackets. That's just asking for trouble. What if some idiot decided to put a logging statement before the return? Then your early return becomes unconditional.
>>
>>59706125
>What if some idiot decided to put a logging statement before the return
Then that idiot should not be working on the code. He could do all kind of stupid bullshit. I shouldn't have to make my code idiot-proof.
Ideally, that would be decided for a style-guide for the project/company/group whatever.
>>
>>59703198
FUCK
>>
>>59706200
It happens quite easily simply because you focus on the program flow and not the syntax while reading code and searching for that place you want to insert something.
>>
>>59706200
You should make your code idiot-proof, because sooner or later someone is going to let idiots loose on it. Saying "I don't need to make my code idiotproof because idiots aren't going to be working on it" is the same as saying "We don't need to carry lifeboats because the ship isn't going to sink".
>>
>>59703135
>do it like
goto fail;
goto fail;
>>
>>59702892
It's a consequence of closures, pattern matching adding and "everything is an expression" increasing nesting. This the logical end product when you try to graft C++ syntax on ML semantics.
>>
>>59702892
>seven levels of indent

That shit should have been refactored four levels ago
>>
Functional programming doesn't have this problem.
>>
>>59708079
Functional programming techniques are a large part of why this happens in Rust.
>>
>>59707165
No. It would be forbidding people to go near the edges of the ship because some idiot might jump off of it.

Code is never idiot-proof, if an idiot is working on your codebase he will fuck shit up and there's nothing you can do about it. All of the "idiot-proof" restrictions are nothing more than massive inconveniences for experienced programmers, and in the end they won't stop idiots from fucking up your code if they're ever allowed to touch it.
>>
>>59708079
Functional programming doesn't have many problems because no one uses it
>>
python doesn't have this problem.
>>
>>59703093
Can do if you're using dictionary comprehension. Plus if you're sending complex POST requests it's pretty difficult not to become lost in nested JSON.
>>
I will propose a fix.

{^x

where x is the number of brackets.
>>
>>59708847
Fok i meant to put a }
>>
if (cond)
{
for (;;)
{
while ()
{

} } }


r8
>>
File: disgusting.jpg (93KB, 1280x720px) Image search: [Google]
disgusting.jpg
93KB, 1280x720px
>>59708920
>>
>>59708290
>putting curly braces around one-line statements is a massive inconvenience
Thread posts: 46
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.