"Visual Design"
-
For example, most bracket styles are absolute no-no's in JavaScript.
I've been a follower of One True Brace for decades. That works just fine in pretty much every single programming language (that uses braces for block-like things at all).
-
BlueJ. I was forced to use it for a class in my Masters' programme.
Are you sure that wasn't just a cover for a psychology study on how to slowly induce insanity? I had to use that for my undergrad Intro to Object Oriented Programming lab. Pretty sure that turd is part of the unholy trinity(Java, BlueJ, Compile Error stack from a missed ; in a BlueJ project) to keep people who would otherwise be interested in Computer Science far-far away.
-
If you use the common boilerplate jQuery widget function style, and add a global above it, you will get the ASI problem:
That's a case of you leaving out a semi-colon. Completely different. JavaScript inserts semi-colon; it doesn't remove the ones you put in.
In any event, I think we've firmly proved that JavaScript making "most bracket styles" into a no-no is a crap claim.
EDIT: it's impossible to turn the typo "semi-colon" in the third sentence into "semi-colons", except editing the post to add this explanation of the Discourse bug will inevitably magically fix it. EDIT EDIT: Oh no it didn't. Heh.
-
In any event, I think we've firmly proved that JavaScript making "most bracket styles" into a no-no is a crap claim.
Whatever. Doug Crockford recommends only OTBS for the reason I mentioned. Take it up with him.
-
And why would you do that? I mean even if it worked in JS, it looks atrocious. Return either goes by itself, or you use it like a function call, them's the rules.
Both "itselves" and functions can be used with ad-hoc temporary variables, including self-made brace-constructed objects. Why return must be special?Also, what's the difference between
return true
andreturn { value = 5, foo = { name = "monday" } }
? Do you want me to always writevar a = true; return a
?
-
And why would you do that?
No fucking idea. Javascript cowboys are inscrutable sometimes.
-
Whatever. Doug Crockford recommends only OTBS for the reason I mentioned. Take it up with him.
Appeal to all the authority!!!!! What does Abe Lincoln think!?
Look. I don't give a shit. I'm taking it up with you because (prepare for a shock) you actually came into this thread and typed it. Hey, here's a news flash: finding out you were actually, without any critical thought, just repeating some expert's opinion actually vastly lowers my opinion of you.
Both "itselves" and functions can be used with ad-hoc temporary variables, including self-made brace-constructed objects.
Ok.
Also, what's the difference between return true and return { value = 5, foo = { name = "monday" } }?
No difference. Note both those lines work fine.
Of course you could enclose the second line in parens, treating "return" like a function call, and that not only works correctly regardless of your brace style, but is easier to read and understand.
Basically what we're hitting up against here is the overloading of curly brace, it's used for creating blocks of code and also for creating ad-hoc objects. Well. Yeah. That kind of sucks. Ok? But it's not a huge deal.
Do you want me to always write var a = true; return a?
Do what the fuck you like. I'm not your czar.
-
No difference. Note both those lines work fine.
Oh, so your problem isn't "who the fuck returns temporary objects" but "who the fuck writes doesn't learn JS caveats before writing JS"?Of course you could enclose the second line in parens, treating "return" like a function call, and that not only works correctly regardless of your brace style, but is easier to read and understand.
I beg to differ.return(something)
makes as much sense asif(((((((((something)))))))))
to me. It's not a function, it's a fucking return statement!Basically what we're hitting up against here is the overloading of curly brace, it's used for creating blocks of code and also for creating ad-hoc objects. Well. Yeah. That kind of sucks. Ok? But it's not a huge deal.
No, what we're hitting here is that JS creates more problem than it solves with its auto-semicoloning.Do what the fuck you like. I'm not your czar.
Sorry. s/Do/Would/
-
Oh, so your problem isn't "who the fuck returns temporary objects" but "who the fuck writes doesn't learn JS caveats before writing JS"?
It's kind of both.
I beg to differ. return(something) makes as much sense as if(((((((((something))))))))) to me. It's not a function, it's a fucking return statement!
Ok well I guess burn it all down. Burn all the JavaScript down to the ground. It's worthless. It has a tiny little caveat in its syntax. Might as well raze it and start over.
Dude, fucking relax. Nobody's going to blow up the planet due to semi-colon insertion. The worst that'll happen is someone'll say, "huh", fix it, and move on with their lives. You know, the thing we both should be doing right now.
No, what we're hitting here is that JS creates more problem than it solves with its auto-semicoloning.
By all means, then! Spend another 473 posts spewing and sputtering about it! Having a semi-colon inserted where you didn't want is worse than 50 Hitlers!!!
Sorry. s/Do/Would/
s/WErt/weaua?SDadgEG2q27dasghj
I don't know what that stupid "s/" meme means and I don't care.
-
Godwin
-
Oh man another appeal to authority fallacy. Those 50 Hitlers are gonna love you.
Look, if you're going to be an intolerable angry asshole (and believe me, I fully get the appeal), at least by angry about something that actually matters. Semi-colon insertion? Seriously? Christ.
-
Appeal to all the authority!!!!! What does Abe Lincoln think!?
Look. I don't give a shit. I'm taking it up with you because (prepare for a shock) you actually came into this thread and typed it. Hey, here's a news flash: finding out you were actually, without any critical thought, just repeating some expert's opinion actually vastly lowers my opinion of you.
Abe Lincoln isn't on the ECMAScript committee and hasn't authored a linter for JavaScript. So, although it's an appeal to authority, it's an appropriate one.I did put critical thought into my adoption of Crockford's stance. He has written plenty about it publically, so "Take it up with Doug" is really a form of "Go look it up yourself, I'm not your secretary". My opinion of JavaScript bracing doesn't change just because the error case is unlikely. It's so easy to make it so that it will never happen and this is one of those bugs where the error message is wholly unhelpful, so I prefer to be proactive.
-
I beg to differ.
return(something)
makes as much sense asif(((((((((something)))))))))
to me. It's not a function, it's a fucking return statement!if (something)
makes about as much sense asfmt.Println(("Hello, World!"))
to me. Why are you putting parentheses around a simple expression?
-
It's not parentheses around an expression, it's part of the if syntax.
-
if jaime.IsLying() { fmt.Println("Hello, World!") }
-
fmt.Println("Hello, World!")
makes about as much sense as fmt.Println(("Hello, World!")) to me. Why are you putting parentheses around a simple expression?
FTFY
-
Found the Ruby enthusiast.
-
who the fuck writes doesn't learn JS caveats before writing JS?
The average programmer intentionally only learns as much as he thinks he needs to do his job.
-
http://play.golang.org/p/Gt7YR2_H7_
if jaime.IsLying() { fmt.Println("Hello, World!") } ```</blockquote> Nobody cares what Go's if syntax is. JavaScript isn't valid without the parentheses.
-
JavaScript also doesn't have a function named
fmt.Println
.
-
fmt.Println("Hello, World!")
makes as much sense to me asif (something)
. Why are you putting parenthesis around a simple expression? Just useprint "Hello, World!"
Filed under: PHP or Perl? You decide!
-
Or
echo 'Hello, World';
Orprintf("%s", "Hello World");
Or<?="Hello World!";?>
PHP - Because there are never enough ways to print a string!
Filed under:
die("Hello, World!")
-
JavaScript isn't valid without the parentheses.
Are you intentionally missing the point?
-
Appeal to all the authority!!!!! What does Abe Lincoln think!?
Abe Lincoln thinks: "Stop appealing to me! I am resting now. Also, what is a Javascript?"
-
JavaScript also doesn't have a function named
fmt.Println
.That actually sounds like a point in favour of Javascript. (Seriously, is
Println
a class constructor now in your weird moon language?)
-
Are you intentionally missing the point?
Perception:if (true)
looks weird because the parentheses seem redundant.
Reality: Most curly-brace languages require the parentheses. Go is among the exceptions. Go looks weird.
-
Perception:
if (true)
looks weird because the parentheses seem redundant.
Reality: Most curly-brace languages require the parentheses. Go is among the exceptions. Go looks weird.I'm still not sure.
-
Look, if you're going to be an intolerable angry asshole (and believe me, I fully get the appeal), at least by angry about something that actually matters. Semi-colon insertion? Seriously? Christ.
Says the guy who'd gone mad because someone said that closures are simple.
-
-
Actually, @riking, too.
-
That was pretty pedantic. Not sure on the dickweedery, though.
-
That actually sounds like a point in favour of Javascript. (Seriously, is Println a class constructor now in your weird moon language?)
Umm, it's just a function in a package(/module/namespace/thingie-containing-other-thingies)...
Though I wouldn't say the name combination is that good (why is the formatting package responsible for writing to standard output?).
-
Just seems weird to go against the general convention that functions start lowercase, classes start uppercase which is common in most normal programming languages (Ruby, Smalltalk, C++, Python, Perl, PHP...)
-
-
general convention
Stop the presses! There are different conventions in different languages. Shocking, yes? ;)
-
But that particular convention transcends languages. It's a metaconvention!
-
But that particular convention transcends languages. It's a metaconvention!
And now you've found a counterexample, a member of a different convention domain. Which one is best? There's only way to find out…
FIGHT!
-
Several classes at my university require you to use that non-ironically.
actually, it's just Dalbey lol
-
Just seems weird to go against the general convention that functions start lowercase, classes start uppercase which is common in most normal programming languages
The .Net base class library makes everything that's public uppercase, for example,s.ToString()
.
-
I learned C on Mac Classic, where C was capitalized like Pascal. For consistency with the OS libraries, which were ported from Pascal. We also used exclusively Pascal-style strings in C.
-
Wasn't Pascal case-insensitive?