|
ToxicFrog posted:Oh. So "automatic semicolon insertion" is "a semicolon is inserted at each newline if one is not already present". Nothing that logical. Some statements or expressions get it inserted only if not having it would produce a parse error, others have it inserted unconditionally.
|
# ? Oct 10, 2011 05:14 |
|
|
# ? May 12, 2024 21:38 |
|
Plorkyeran posted:The rules are actually significantly more complicated than that, but it pretty much comes down to that if a line doesn't end in a semicolon and it would syntactically valid to have a semicolon at end of the line, the interpreter tries its hardest to do the opposite of what you wanted it to. Not going to even attempt to defend automatic semicolon insertion, but if anyone's genuinely curious about when it happens, here's a decent summary of the standard. It's not so insane that semicolon-free JavaScript is impossible to write, but I'd guess almost nobody bothers and just tosses in semicolons everywhere. I really don't understand why someone would see two options, "require semicolons" and "don't require semicolons", and decide to go right down the middle. Sometimes it's ok to pick one!
|
# ? Oct 10, 2011 05:28 |
pokeyman posted:I really don't understand why someone would see two options, "require semicolons" and "don't require semicolons", and decide to go right down the middle. Sometimes it's ok to pick one! Someone had had enough of his compiler telling him that he probably forgot a semicolon somewhere and had a great idea: "If the compiler can tell me where they need to be, let it insert them for me!"
|
|
# ? Oct 10, 2011 05:33 |
|
pokeyman posted:Not going to even attempt to defend automatic semicolon insertion, but if anyone's genuinely curious about when it happens, here's a decent summary of the standard. It's not so insane that semicolon-free JavaScript is impossible to write, but I'd guess almost nobody bothers and just tosses in semicolons everywhere. I can see the merits of both sides of the argument, for and against semicolons as statement delimiters. But there's sort of a rule on Algol/C like languages that a statement termination is a semicolon and when you break that rule the compiler/interpreter tells you done hosed up. JavaScript is kinda like a junky who comes back and says, hey man that's cool. And it is cool, until you have to blow a elephant. I'm not sure if the analogy carries, but wow. Debugging that particular syntax error really sucks. edit: changed analogy to be more friendly Pimblor fucked around with this message at 14:35 on Oct 10, 2011 |
# ? Oct 10, 2011 05:37 |
|
The correct answer is to use Coffeescript.
|
# ? Oct 10, 2011 05:41 |
|
JS rather gets a pass because Brendan Eich had eight days to go from conception, implementation, to production or else 'something even more horrible would have been unleashed'. I don't think he ever really stated what it was, but it was probably some sort of Java derivative since Netscape and Sun were trying to team up around then. Once everything ever was using Javascript with all of its bugs and quirks, it became pretty much impossible to go back. The real horror is nobody except MS even bothered to implement anything else. <script type="text/javascript"> is there for a reason. I'm surprised google hasn't embedded Python or Apple put Ruby into WebKit.
|
# ? Oct 10, 2011 06:03 |
|
NotShadowStar posted:The real horror is nobody except MS even bothered to implement anything else. <script type="text/javascript"> is there for a reason. I'm surprised google hasn't embedded Python or Apple put Ruby into WebKit.
|
# ? Oct 10, 2011 06:09 |
|
Hu Fa Ted posted:JavaScript is kinda like a junky who comes back and says, hey man that's cool. And it is cool, until you have to blow a tranny. I'm not sure if the analogy carries, but wow. If the point of your analogy was "JavaScript is a bigoted joke", you did great.
|
# ? Oct 10, 2011 07:25 |
|
yaoi prophet posted:The correct answer is to use Coffeescript. or clojurescript
|
# ? Oct 10, 2011 14:05 |
|
pokeyman posted:If the point of your analogy was "JavaScript is a bigoted joke", you did great. I have no idea where I was going with that analogy, I think it sounded better in my head. The analogy that is. I've been bitten by the automatic semicolon, and by extension returning a block. i.e.: code:
|
# ? Oct 10, 2011 14:33 |
|
if you used the one true brace style that would never happen hth
|
# ? Oct 10, 2011 16:32 |
|
Someone posted this a while back.
|
# ? Oct 10, 2011 16:38 |
|
The Crockford book is 100% required reading for anybody doing any Javascript ever. It completely changes how you think about the language. The man has been around forever and has a keen sense of language history, really knows his stuff and can give a reasoned opinion on things.
|
# ? Oct 10, 2011 16:59 |
|
At least watch that video.
|
# ? Oct 10, 2011 17:39 |
|
Xenogenesis posted:https://code.google.com/p/phpreboot/ It is nice that they aim to be "more in sync with the Web of 2010".
|
# ? Oct 10, 2011 21:44 |
|
NotShadowStar posted:I'm surprised google hasn't embedded Python or Apple put Ruby into WebKit. What a perfect day to have this discussion. I'm just sorry they didn't say gently caress it and actually use Python :\ Also, https://code.google.com/p/phpreboot/ posted:XML and SQL can be mixed together
|
# ? Oct 10, 2011 22:36 |
|
NotShadowStar posted:I'm surprised google hasn't embedded Python or Apple put Ruby into WebKit. They just did http://www.dartlang.org/
|
# ? Oct 11, 2011 02:17 |
|
code:
|
# ? Oct 11, 2011 02:29 |
|
I am become death, destroyer of DOMs.
|
# ? Oct 11, 2011 02:33 |
|
Oh goodie another class-based language with worse syntax than what's out there. I don't loving get google at all. I also get the impression google doesn't get google either. I mean Go was SO successful that they had to invent yet another thing. Or GWT, what a miraculous thing that was! There's a really good reason why Brendan Eich busted his rear end to make sure a strongly typed Java style class based languages weren't driving the web and google goes all 'welp' over and over. Ah well another project from google to go 'hmm' and then ignore.
|
# ? Oct 11, 2011 04:43 |
|
NotShadowStar posted:I mean Go was SO successful that they had to invent yet another thing.
|
# ? Oct 11, 2011 08:27 |
|
NotShadowStar posted:I mean Go was SO successful that they had to invent yet another thing. Go looks like a miracle compared to this poo poo.
|
# ? Oct 11, 2011 08:34 |
|
Go doesn't require every person on the planet to upgrade their web browser to as-yet-unwritten versions in order to be useful.
|
# ? Oct 11, 2011 08:54 |
|
pseudorandom name posted:Go doesn't require every person on the planet to upgrade their web browser to as-yet-unwritten versions in order to be useful. Are you implying that some future version of Chrome will make Javascript-with-optional-typing useful?
|
# ? Oct 11, 2011 08:59 |
|
code:
code:
|
# ? Oct 11, 2011 09:06 |
|
NotShadowStar posted:Oh goodie another class-based language with worse syntax than what's out there. I don't loving get google at all. I also get the impression google doesn't get google either. I mean Go was SO successful that they had to invent yet another thing. Or GWT, what a miraculous thing that was! it isn't strongly typed go and dart address wildly different problem spaces this is actually close to gwt though in some respects I do love all of the indignant rage from all the programmers who see the word 'java like' and start frothing without actually finding out the implementation of the language.
|
# ? Oct 11, 2011 11:38 |
|
Wait a minute, classes, interfaces, optional typing, server side support, sort of javascipty.... http://msdn.microsoft.com/en-us/library/ms974588.aspx
|
# ? Oct 11, 2011 12:33 |
|
google wasabi
|
# ? Oct 11, 2011 12:43 |
|
mjau posted:
is this real how can this be real
|
# ? Oct 11, 2011 13:05 |
|
TasteMyHouse posted:how can this be real Actually checking types is actually specified to not be an impediment to the program running in Dart. EDIT: The type annotations are to make the refactoring tools in Eclipse work.
|
# ? Oct 11, 2011 13:15 |
|
Zombywuf posted:Actually checking types is actually specified to not be an impediment to the program running in Dart. I'm just astounded that they made a language where you can call something an "int" which then behaves like a float. if those are just type "annotations" and not real type declarations, they should've chosen a different way of writing it. TasteMyHouse fucked around with this message at 13:59 on Oct 11, 2011 |
# ? Oct 11, 2011 13:18 |
|
mjau posted:
Ah, a replacement for PHP.
|
# ? Oct 11, 2011 13:23 |
|
Apparently that code triggers a warning, "double is not assignable to int" http://try-dart-lang.appspot.com/s/_44V but uh... so does this http://try-dart-lang.appspot.com/s/D-cV
|
# ? Oct 11, 2011 14:09 |
|
TasteMyHouse posted:Apparently that code triggers a warning, "double is not assignable to int" http://try-dart-lang.appspot.com/s/_44V That's because / is the floating-point division operator. The integer division operator is ~/.
|
# ? Oct 11, 2011 14:50 |
|
Is it weird that I find the notion of an entry point for a Also this is totally a solved problem http://projects.nikhilk.net/ScriptSharp
|
# ? Oct 11, 2011 15:06 |
|
Munkeymon posted:Is it weird that I find the notion of an entry point for a It seems kind of nice to me, actually. Presuming I can put a main in an included file, I can put it at the top of the file, instead of jamming it in at the bottom or using some weird DOM event hooks to trigger it to start.
|
# ? Oct 11, 2011 15:11 |
|
BonzoESC posted:It seems kind of nice to me, actually. Presuming I can put a main in an included file, I can put it at the top of the file, instead of jamming it in at the bottom or using some weird DOM event hooks to trigger it to start. There may be things you want to have done before the DOM is ready and things you will want to do after, so driving that with the regular event system just makes sense. I would agree that it's nice to have main(){} as a shorthand for the code to hook the DOM Ready event (if that's what it actually means - I haven't found that in the docs yet), but jQuery pretty well solved event management problems already.
|
# ? Oct 11, 2011 16:18 |
|
Munkeymon posted:There may be things you want to have done before the DOM is ready and things you will want to do after, so driving that with the regular event system just makes sense. I would agree that it's nice to have main(){} as a shorthand for the code to hook the DOM Ready event (if that's what it actually means - I haven't found that in the docs yet), but jQuery pretty well solved event management problems already. Now what about something you want run after the file is parsed but before the DOM loads? How does jQuery help you put that at the top of the file where you can find it quickly instead of at the bottom?
|
# ? Oct 11, 2011 16:26 |
|
How does jQuery help wit a lot of things that I suddenly decided were a problem?
|
# ? Oct 11, 2011 17:20 |
|
|
# ? May 12, 2024 21:38 |
|
BonzoESC posted:Now what about something you want run after the file is parsed but before the DOM loads? How does jQuery help you put that at the top of the file where you can find it quickly instead of at the bottom? //do this poo poo now bro ( function () { console.log('dickbutt') } () ) Yeah somebody is gonna be a Dart apologist here. They are wrong. https://gist.github.com/1277224 code:
|
# ? Oct 11, 2011 17:49 |