Well, its semi-useless enums suck, but other than that I'm quite happy with it.
1,026 karma · joined December 11, 2011
Well, its semi-useless enums suck, but other than that I'm quite happy with it.
The VM is crossplatform and it even supports ARM and MIPS.
They are also working on an interpreter which will get around the JIT restrictions on iOS and Windows Phone.
With ES8 or ES9, maybe.
By the way, optional named arguments with default values look atrocious in ES6.
ES6: function foo({a = 1, b = 2} = {}) {…}
Dart: foo({a: 1, b: 2}) {…}
Dart also supports things like factory constructors, named constructors, method cascades, operator overloading, SIMD, arbitrary large integers, mixins, implicit getters/setters, implicit interfaces, enums, 'a' - 2 is a type error, [0][-1] is a range error, metadata annotations, and of course also optional types.
ES7 might include SIMD and operator overloading.
Another key point is that Dart's doc comment syntax is standardized. It also has an official style guide, a formatter, and a package manager.
To me, these things are also very important features.
Is this the only noteworthy ES6 feature which isn't tested?
Writing larger applications in a team isn't impossible with JavaScript. It's just needlessly difficult.
Well, even if it's just me, after a few hundred lines of JS, I really start to miss proper tooling.
ES6 did at least add some structure and tooling hooks with classes, modules, default parameters, and named parameters (via destructuring). However, it's nowhere near the kind of tooling you get with TypeScript or Dart.
Optional types are really handy. Just add some types to the signatures of your functions and you get massive tooling benefits (and basic documentation).
You didn't include the regular TP. With a bidet or washlet, you'll need a lot less of that, too.
> $500 on toilet seats?
There are much cheaper options available. As another commenter mentioned, you can get a non-electrical attachment for as little as $30.
For example:
http://www.amazon.com/Luxe-Bidet-Neo-110-Non-Electric/dp/B00...
Edit: Also, you were comparing the price for upgrading two toilets with the wet wipes expenses for a single person.
That's even true if you use regular toilet paper, because you'll need a lot less of that.
Having actual integers? Threads? Better tooling?
The `class` keyword? It makes the code less verbose.
Optional types? Would you rather write JSDoc comments?
Optional typing actually works amazingly well. You need very few type annotations to get all the tooling benefits. Typically, it's enough to annotate the headers of your function. Type inference takes care of the rest.
I mean something like this: https://atom.io/packages/ide-flow
Tool-tips, call-tips, auto-complete, type checking, and so forth. The kind of stuff you get with TypeScript or Dart.
Also note that you could now add a thousand lines of code and the file size wouldn't increase much. You already paid that one-time cost.
You can further improve the size by using a better minifier on top of --minify.
No, it's not.
dart2js --minify hello.dart -o hello.dart.js
Results in a 5 KB JS file.This game is 35 KB (procedural graphics included):
You can interact with JS libraries, but exposing some API to JS-land is a completely different matter.
There are some vague plans to improve this, but there hasn't been much interest, because if you use Dart anyways, you do of course want to use it as the "host" language. It has the tooling and all that jazz. Of course you'd want to use it for as much as you can.
I meant the writing stage, not the checking stage.
Imagine you don't know which type to pass. So, you'd have to pass something (null or whatever) in order to generate an error which gives you a clue.
That doesn't sound very convenient.
Well, the machine could check which types match that fingerprint, which might work okayish if the list isn't too long, but it won't tell you anything about the writer's intend.
Is a list of doubles, a list of ints, a Float32x4List, or a Float64x2List really the same thing?
What if it's actually meant to be used with something else which also supports the [] operator and whose items support the + operator.
Static analysis might not be able to tell you because it doesn't know all packages in existence. That package might not have been referenced, because that's not required to use a type from that package.
How does the generated documentation look like? It takes one argument "foo" which is something which has a "bar" field and a "baz" method? I'd rather have a concrete type there. "int x". Done.
What if you optimize the function a bit and now the fingerprint doesn't match one or more types anymore. Was this a breaking change?
Your intention didn't change. You always had one particular type in mind.
As the author mentioned, a machine can look at how the arguments are used and make some educated guesses. The big problem is that humans have to do the same.
That's why I like optional types à la Dart. Not only do they help with static analysis, they also act as documentation.
With a good editor, this documentation is right at your fingertips. When you type a function's name, a call-tip will remind you of the expected arguments. If you've added type annotations, the types will be there, too.
Yes. Now your editor/IDE knows that that thing is supposed to be a class. The doc generator also knows that it's a class. Furthermore, this makes things more compatible since framework A and library B use the same kind of classes.
Finally, it means that you won't have to waste time with evaluating a dozen semi-popular options to handle classes/inheritance.
It does of course also make your code a lot easier to read and it makes it easier for new developers who used some other language with classes before.
> Hopefully ES7 doesn't get the verbose syntax of Java/C#.
I recommend to take a look at TypeScript and Dart. Optional types aren't verbose. You just add some types to the surface area, which, compared to JSDoc, is drastically less verbose. Inside functions, you can generally omit the types.
New syntax, on the other hand, can be added without breaking existing code. These new constructs would have been syntax errors beforehand.
Common usage of CSV is US-ASCII, but other character sets defined
by IANA for the "text" tree may be used in conjunction with the
"charset" parameter.
Basically, you can specify that it's UTF-8 or whatever via the Content-Type response header. Setting this response header isn't something an encoder could do. A CSV parsing library also shouldn't be responsible for loading the CSV file via HTTP. In most cases, CSV files aren't directly fetched via HTTP anyways.Anyhow, ASCII is utter nonsense. We aren't living in an ASCII world. Even the Americans don't do that. An ASCII-only format is completely useless.
This isn't a problem with JSON, XML, ASN.1, Protobufs, or Thrift. Anything other than CSV, really.
The encoding, line endings, and the used separators are random. Encoding/decoding behavior may be locale-dependent. E.g. if you use Excel with a de-DE locale to create a CSV file, Excel with a en-US locale won't open it. The former uses ';' as separators and the latter expects ','.
Since the format is so (seemingly) simple, there are millions of ad hoc implementations out there. Naturally, most of them are horribly broken.
Fun fact: ASCII actually reserved control characters for this stuff. 1F is the "unit separator" and 1E is the "record separator". There is even a "group separator" (1D) and a "file separator" (1C).
Aggressive type coercion is not type safety. It does not prevent type errors. It just sweeps them under the rug.
5 - 'foo'
That's a type error. It's not a convenient shortcut for `NaN`.I had the same problem. I had one tiny pocket book with less than 150 pages and Turbo C's built-in help system which was basically just trimmed down API docs. A list of header files which lead to a list of functions which lead to a short 1-2 sentence description.
But I still had a lot of fun.
I agree that the first language isn't that important, if you switch to something else shortly thereafter. However, I think it's a bit problematic if you keep using this one language exclusively for a couple of years.
Maybe BASIC wasn't such a bad idea. No one wants to stick with that and it's also rarely used in production. If you start with something like BASIC, you're forced to switch.
Iterating over an array in reverse allows you to remove items in the same iteration (at the very end of the loop). If you delete an item, the items which follow are downshifted by one which means that their indices also change.
However, this isn't a problem if you iterate in reverse, because you already took care of those items in previous iterations. The item you'll handle next will stay where it is.
This also works nice with unordered lists (or "bags").
It does.
There is an IIFE which is run when the script is loaded. Right before the object is returned to the global "Intercooler" variable, a callback is registered via a jQuery.ready() shorthand.
Practically speaking, this callback is the entry point (theoretically, it's the IIFE itself).
If it wouldn't have an entry point, adding attributes to elements would do nothing.
http://en.wikipedia.org/wiki/Entry_point
"an entry point is where control enters a program or piece of code"
If it has an entry point, it's not a library, it's an application. If said application does basically nothing on its own and you're supposed to extend it, it's a framework.
http://en.wikipedia.org/wiki/Software_framework
Pay close attention to the 4 bullet points in the first section.
> On "use strict", my understanding was that it applies per script
Yes. However, when you merge scripts, there is only one script at the end.
The site you linked to also mentions this problem.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
"This syntax has a trap that has already bitten a major site: it isn't possible to blindly concatenate non-conflicting scripts. [...] It is thus recommended that you enable strict mode on a function-by-function basis [...]"
Anyhow, move that "use strict;" line into the IIFE. If it's global, you can't merge that file with other files. Some of the code out there breaks in strict mode. That's why it isn't enabled by default.
I use it for Enso, which lets you start programs, open files, spellcheck, count words, do math, and things like that.
Using it to swtich between input methods is another good choice.