10 ms·
Programming tends to this pattern where people get super-excited when a language gets a feature everyone else has taken for granted forever. It's like a guy ge
by fizx 13y ago
Programming tends to this pattern where people get super-excited when a language gets a feature everyone else has taken for granted forever. It's like a guy getting out of the hospital after shooting himself in the foot. You know what's better? Not shooting yourself.
Congrats Javascript--on almost being as good at data-binding and layout as VB6! Me, I'm going to keep kvetching about javascript frameworks until flexbox is widely supported, the strongly-typed language flavor-of-the week actually is stable, and frameworks like angular don't embrace silent failure modes as a feature.
- lucisferre 13y ago> don't embrace silent failure modes as a feature. I love Angular and perhaps in some places, and at certain times silent failures make sense (but would a console.log kill you?) but yeah... A-men!
- catnaroek 13y agoThe problem with silent failures is that they are a bad default. Sometimes, the best default is providing no default at all: just throw an exception that must be handled by the programmer. If you want to recover the silently failing behavior, you can always provide a wrapper function that catches the exception and handles it by doing nothing at all. (Admittedly, this is not so easy in nonfunctional languages like JavaScript that make it painful to program with combinators.)
- alxhill 13y agoThe reason Angular has silent failure by default is because failure is designed to happen all the time - this means angular expressions can deal with data that hasn't arrived/hasn't been created yet. This might sound like a bad thing, but it actually makes the page work without confusing the expression syntax with endless or statements. That said, I do see your point - it's frustrating to find something not working due to a typo in an expression, with no errors to point it out. A halfway solution could be some kind of debug directive/tag that logs when an expression doesn't evaluate? Or perhaps something integrated into Angular Batarang? (https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk?hl=en https://chrome.google.com/webstore/detail/angularjs-batarang...)
- derefr 13y agoPeople get excited about things happening to Javascript because, if you want to run your code in a browser, there's no alternative. So it's not so much "Javascript", some crappy language, getting that feature; it's all-web-programming getting that feature.
- catnaroek 13y agoSome people (myself included) prefer a more radical approach: Rather than fixing the inteface JavaScript presents ot the programmer, we replace JavaScript (or, actually, all three of HTML, CSS and JavaScript) with a different language that is actually designed not to be crap. For example: http://elm-lang.org/ http://elm-lang.org/
- hoverbear 13y agoThen we all get stuck supporting both until its universally adopted (you know how some people still use XP?) It is a noble desire though.
- catnaroek 13y agoElm compiles to HTML, CSS and JavaScript.
- moe 13y agoI'd love a modern GWT. One that's not rooted in java. Elm doesn't look like it wants to be that, though. It seems to be aimed at games and graphics. There is not a single complex form, multi page flow or interactive layout in the examples.
- chris_mahan 13y agoooooohhh where have you been all my programming life... edit: explanation: I really dig it!
- catnaroek 13y ago
- dmethvin 13y ago> Congrats Javascript--on almost being as good at data-binding and layout as VB6! That's total garbage. The browser does awesome presentation and layout with the markup you give it and you can control what happens via declarative CSS. VB6 couldn't even make a dialog look nice when you changed the system to Large Fonts. Silent failure? You must have forgotten `on error goto 0`.
- chris_mahan 13y agoon error resume next
- millstone 13y agoI wouldn't characterize web layout as "awesome." Look at the contortions required for basic tasks like equal height columns.
- akmiller 13y agoI wouldn't characterize web layout as "awesome." I would. I've been doing web development for a long time, along with many other types of development, and although there are quirks (as there are with anything), you can do nearly anything via web layouts. The flexibility of the system, and things people have accomplished with it, is really amazing when you stand back and look at it as a whole.
- millstone 13y agoI don't mean to offend, but it sounds to me like you've just internalized the limitations of web layout. For example, look at email clients. The native mail apps on my Mac and iPad can show me all of my inbox in one big list. I can scroll through tens of thousands of messages naturally, easily jump to the bottom or top of the list, etc. Web pages cannot support this. Yahoo mail attempts to present the messages in one big list, but the experience is pretty bad. The scroll bar looks fake and feels wrong, find doesn't work like you'd expect, the scroll thumb changes size and jumps around as you scroll, scrolling to the bottom is Sisyphean, etc. And Yahoo mail is one of the better webmail clients. Gmail didn't even try. Instead it refuses to show more than 100 messages at a time, with buttons to paginate. When I work on web pages, I don't get a feeling of freedom or flexibility. Instead I find myself forced to compromise on the user experience over and over again, just like Google and Yahoo did with their webmail clients.
- oinksoft 13y agoAre you saying that VB6 as a platform is superior to the web in its current state, all things considered? The comparison is silly, there is no competition in terms of distribution, portability, flexibility. Can you not see how it is remarkable that web development tools can rival desktop GUI environments, given that by design, everything on the web is running in a very limited sandbox, one based largely on the work of slow-moving standards bodies?
- catnaroek 13y agoI have yet to see any widely used Web development tool that facilitates local reasoning: looking at a piece of code and knowing what it can or cannot do, without having to look at the rest of the program/page/stylesheet/whatever.
- fizx 13y agoWeb components/shadow DOM may help sooner or later. http://www.w3.org/TR/2013/WD-components-intro-20130606/ http://www.w3.org/TR/2013/WD-components-intro-20130606/
- RWeaver 13y agoAnd Angular directives are pretty self contained, with their own scope, template, functions, etc. You need angular.js obviously, but that's just the generic library.
- lelandbatey 13y agoYeah, you're right, that is cool and that is remarkable. But Javascript still really sucks sometimes. To use an analogy: I'm not saying the plane doesn't fly, but I am saying the plane seats are uncomfortable. Also, this is a total aside: what if there actually was a way to stuff like C++ on a computer in sandboxed environment that could be loaded automatically by a user in a seamless way? If that happened, if you took away Javascripts monopoly of the highly portable and convenient environment, it'd be dropped so fast you could blink and miss it.
- Tloewald 13y agoVB6 didn't have structured types, and its binding was garbage.
- catnaroek 13y agoVB6 had structs - they were called user-defined types. VB6 does not autodeclare global variables when you forget to type "var". And, if you use Option Explicit and avoid Variants and Objects, you can have some limited degree of type safety. VB6 is by no means a good language, but JavaScript is much, much, much worse.
- midge1b 13y ago> VB6 does not autodeclare global variables when you forget to type "var". Nor does JavaScript... "use strict"; Being what it is, JavaScript has come on a long way. Saying "avoid this specific feature" does make a language better. The same can be said about specific features of JavaScript (with, eval) but I'm sure you wouldn't make the same argument. The fact seems to be that people are stuck in their ways and hate on JavaScript because they don't know the language as well they could and they haven't kept up to date with the evolving standards.
- PommeDeTerre 13y agoPeople who "hate on JavaScript" tend to know the language very well. They also know at least several other languages very well. This knowledge makes JavaScript's many flaws much more obvious, and much less justifiable. The basic fact is that prototype-based OO, for example, is much less practical than class-based OO. Experienced developers comprehend JavaScript's attempt at it just fine. This understanding doesn't change its inferiority, however. This is exactly why so many developers need to compensate for JavaScript's lack of desired functionality in this area by trying to fake class-based OO using the limited functionality that JavaScript does offer. The same goes for many other aspects of JavaScript. Bad tools are still bad, even in the hands of experts. I'm not really sure what you're talking about when you mention "evolving standards". If anything, JavaScript's standards haven't evolved well at all. Harmony is only now proposing the addition of core functionality that has been present in other languages for decades now, and should have been in JavaScript from the very beginning, too. JavaScript is merely "evolving" to where it should have been many years ago.
- TheZenPsycho 13y agoYes yes, everything that's happening now has happened before with other technologies. Except this time: 1. it's in a runtime that is in more machines than any other in history. 2. can be loaded instantaneously with no installation procedures. 3. and no plugins 4. On almost any platform, linux, mac, windows, ios, android, windows phone, blackberry, palm, chrome OS, even game consoles. Including the nintendo DS! 5. is broadly accessible to people with various kinds of disabilities 6. doesn't require a team of 20 engineers taking 4 years to build. (which other tech has achieved, and arguably much better, but not combined with the other things above) 7. Works on miniature computer machines small enough to fit in your pocket, and can download your app wirelessly. From the air. in your pocket. FROM FUCKING OUTER SPACE (incidentally, did HN skip out on the whole ordered list notation of markdown?) edit; To add a couple more points: * SEARCH ENGINES can automatically index your shit. * We have these things called hyperlinks which allow automatic, ubiquitous and pervasive interoperation everywhere. I see a common pattern on HN where whenever the topic of javascript comes up, all you see is pages and pages of wretching about how AWFUL it is, and how you could do X in Y language Z years ago already. That's not the hacker spirit. A hacker looks at what's out there, and what's possible, shuts up, and builds something awesome with it. (and then wretches about how awful it was) In fact, the WORSE the underlying technology used to build something awesome, the more proud the hacker is that they achieved it. Where's that spirit? Sure it's not as nice to program in as your favourite language or environment, but it's come a long damn way. would you give it a minute?
- foobarbazqux 13y agoSurely 1-5 applied to Basic. Why not VB6?
- TheZenPsycho 13y agono they didn't. (what alternate universe did you arrive from?) And /not VB6/ because microsoft lost that battle. And not java, because sun lost that battle. And not flash, because adobe lost that battle, and not unity, because they haven't, and won't win that battle, for the same reasons all the others lost.