HNHacker News
TopNewBestAskShowJobs

ahoge

1,026 karma · joined December 11, 2011

submissionscomments
ahoge··on Dart Programming Language Specification [pdf]
You are missing the point. jQuery fixes the DOM API. Dart's "dart:html" already provides a clean nice-to-use API. All those list-like things are actual Lists. Futures and Streams are also baked into the language. Normalization also isn't needed anymore.

> Apple, FF, MS are all against Dart.

Oliver Hunt isn't Apple. Brendan Eich isn't Mozilla. He doesn't even work for Mozilla anymore.

Mircosoft's JavaScript team also isn't equivalent with Microsoft itself. It also would be pretty weird for them to endorse Dart.

They have TypeScript, which sells Visual Studio, which sells Windows licenses, which sells the Microsoft ecosystem, which sells Windows Server licenses.

That's how they operate and there is nothing wrong with that, really. If you have a large existing JavaScript codebase which you want to keep, TypeScript is a pretty good choice.

ahoge··on Dart Programming Language Specification [pdf]
> What does [Dart] do better than similar languages that compile to JS (CoffeeScript, Typescript, etc)?

CoffeeScript doesn't really help with scaling. It's basically just a slightly more compact JavaScript dialect. Personally, I don't see the point.

TypeScript is closer. It offers type annotations and more structure. Being a strict superset of JavaScript also means that it can't fix any of JavaScript's issues. However, it also means that it can seamlessly interact with JavaScript.

Dart is a clean break. Straightforward, nice semantics, and none of the weird stuff. There are official code conventions, a package manager, a doc generator, and a built-in way to do inheritance. Compared to JS, this skips a lot of research and pointless discussions. Naturally, it also avoids the associated compatibility issues and annoyances.

The VM is also a big advantage, because you don't have to compile your code hundreds of times a day during development.

As a result, the compiler can perform rather heavy optimizations, because compile speed isn't the top priority anymore.

Having that VM also allows you to write command line tools and web servers. It can be also embedded in other applications.

Anyhow, if you know something like C#, you already know most of Dart's syntax. Just give it a try. You can be productive on your very first day. It's really that straightforward.

ahoge··on Dart 1.5
It will just cause a `pub get` fail (Package foo requires SDK version >=1.5.0 but the current SDK is x.x.x), but it won't prevent the application from running. Only `pub` cares about that pubspec.yaml file.
ahoge··on Dart 1.5
> Any performance improvements seen by your users won't apply to those using any other browser.

It will be still about as fast as regular JavaScript.

ahoge··on Dart 1.5
The SDK is shipped with a standalone version of the VM which can do I/O (via the 'dart:io' package). You can use it to write command line applications and web servers. Basically, it's like Node right off the bat.

I/O performance increased drastically with 1.3. The performance is tracked over here:

https://www.dartlang.org/performance/io/

1.4 added experimental support for ServerSocket references, which allow you to share a socket across isolates (~"workers"):

https://groups.google.com/a/dartlang.org/forum/#!topic/misc/...

ahoge··on Dart 1.5
An interesting advantage compared to Dalvik (or the JVM) is the ability to make use of SIMD. If your bottleneck would benefit from SIMD, you can gain quite a lot.

It does of course require some additional work, but thanks to operator overloading it looks fairly nice.

ahoge··on V8 Optimization Killers
Generally. Technically, it's a "breaking change".

As you can imagine, this didn't actually affect anyone.

ahoge··on V8 Optimization Killers
That's an ES5 change. With ES3, you can overwrite NaN, Infinity, and undefined.
ahoge··on Go support for Android
Yes, a language specification is just a prerequisite for standardization. However, it's also useful for people who want to write their own implementation or tools. It also makes issue handling a bit smoother, because you can always check what the spec says if two bits of the ecosystem disagree with each other.
ahoge··on Go support for Android
From the very first paragraph:

"The grammar described here is intended to help you understand the language in more detail, rather than to allow you to directly implement a parser or compiler."

A language specification is for people who want to implement a parser/compiler/VM/etc. It's something you need if you want to standardize it (e.g. TC39 [ECMAScript] and TC52 [Dart]).

A language specification is also generally clearly labeled as such.

http://en.wikipedia.org/wiki/Programming_language_specificat...

PHP, for example, doesn't have one.

ahoge··on Go support for Android
I can't find a language specification anywhere. Can you give me a link?

go language spec hit #1:

http://golang.org/ref/spec

dart language spec hit #1:

https://www.dartlang.org/docs/spec/

java language spec hit #1:

http://docs.oracle.com/javase/specs/

For Swift, I can only find guides and references.

ahoge··on Go support for Android
Go also has documentation. Also, Go has a spec. Swift doesn't. That's a pretty big deal, don't you think?

Android is fairly open. You can run whatever you want on that platform. If you want to use LuaJIT, no one can stop you.

Also, this isn't "Google". It's one guy working for Google. He's on the Go team. He wants to make Go a viable option for games on Android.

If you like Go, this is a good thing.

ahoge··on Gofmt No Longer Allows Spaces. Tabs Only
You can also change it to 4 (which is what most editors use by default) via `tab-size`:

https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size

ahoge··on Gofmt No Longer Allows Spaces. Tabs Only
I prefer tabs (tab-size: 4), but I prefer even more if everyone follows the same conventions.

Dart, for example, uses 2 spaces. When I write Dart code, I use 2 spaces.

And that's the end of that. As history has shown, there is absolutely no point in discussing this. There is no clear winner.

ahoge··on I’m Just Now Realizing How Stupid We Are
That's just the most extreme form. As with most things, it's a gradient.

If you know that there are things you don't know, you'll probably be more humble. If you feel overwhelmed, because there doesn't seem to be an end in sight, it might affect your confidence.

ahoge··on I’m Just Now Realizing How Stupid We Are
> I've learned that there's a strong correlation between knowledge and humility.

It's the Dunning–Kruger effect:

http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect

ahoge··on Intel Bringing SIMD to JavaScript
I don't see how that would be related to SIMD support in JavaScript.
ahoge··on Intel Bringing SIMD to JavaScript
Huh? If JavaScript the compiler target supports SIMD, your SIMD-supporting language can make use of that.

Dart will do that. Python, Haskell, or whatever are free to do the same.

ahoge··on Intel Bringing SIMD to JavaScript
> if I need a specific version of specific browsers (which it is)

No, you don't need a specific browser. You can polyfill it. (The reference implementation is a polyfill.)

If you want the performance benefits, you'll need to update your browser. But that's true for JavaScript in general. IE8's engine is very slow, for example. Only the most recent browsers can offer the best performance.

ahoge··on Intel Bringing SIMD to JavaScript
> Unless there is a usecase for averaging gazillion numbers on the client

Adding 2 numbers (x4) is just the simplest thing you can do.

There are a bunch of other operators and methods:

https://api.dartlang.org/apidocs/channels/stable/dartdoc-vie...

Good intro:

https://www.dartlang.org/articles/simd/

GMMs in speech recognition:

http://dartogreniyorum.blogspot.com/2013/05/performance-opti...

(Be sure to check the follow up article for the updated numbers.)

ahoge··on Intel Bringing SIMD to JavaScript
> this really is such a niche feature

Yes, it is. However, it's relatively easy to implement and the performance improvements and battery savings are fairly huge. All things considered, it's a pretty good deal.

ahoge··on Intel Bringing SIMD to JavaScript
It requires SSE2 just like Dart's SIMD implementation. SSE2 is supported by virtually every desktop CPU (including VIA and Transmeta).

Dart's SIMD stuff works just fine on AMD CPUs which were produced in the last 10 years (the K8 line started in late 2003).

ahoge··on Intel Bringing SIMD to JavaScript
Auto-vectorization is an extremely complicated topic. This stuff is slow. Not a big deal with AOT compilation, but it's of course a huge deal if you only have a few msecs to spare.

Also, a machine can't just jumble the operations around because that would change the result.

  >> 0.1 + 0.2 + 0.3
  0.6000000000000001
  >> 0.1 + (0.2 + 0.3)
  0.6
So, this is apparently something you have to do yourself. A compiler won't know what kind of data will be fed to that function. It can't make an informed decision.

> In fact I am not even sure what kind of physics needs SIMD.

It generally just means that you use some physics library which makes use of SIMD. Without having to do anything special, your game will run drastically better an use less energy to boot.

That's the primary use case; using libraries which use SIMD. Most people won't bother doing that by themself.

ahoge··on Intel Bringing SIMD to JavaScript
Check "Bringing SIMD to the Web via Dart" by John McCutchan:

https://www.youtube.com/watch?v=CKh7UOELpPo

He's also the guy wrote the proposal for ECMAScript:

https://github.com/johnmccutchan/ecmascript_simd

Also, using SIMD is way easier than using shaders. You just write something like this:

  double average (Float32x4List list) {
    var n = list.length;
    var sum = new Float32x4.zero();
    for (int i = 0; i < n; i++) {
      sum += list[i];
    }
    var total = sum.x + sum.y + sum.z + sum.w;
    return total / (n * 4);
  }
Instead of:

  double average (Float32List list) {
    var n = list.length;
    var sum = 0.0;
    for (int i = 0; i < n; i++) {
      sum += list[i];
    }
    return sum / n;
  }
ahoge··on Firefox 30.0
It's either <input ...> (SGML flavor) or <input .../> (XML flavor).
ahoge··on Firefox 30.0
It's a sort-of serialized representation of the DOM.
ahoge··on LLVM based JavaScript JIT that beats V8 on Asm.js benchmarks
V8 supports asm.js as any other ES3-compliant JavaScript engine. It also has many optimizations in place which benefit from asm.js-style code. Asm.js-style code also simply doesn't do those expensive JavaScript-y things. That's why that Citadel demo runs just fine in Chrome, too.

However, V8 doesn't have a separate mode. The "'use asm';" pragma is ignored.

The Octane benchmark suite does contain Emscripten and Mandreel benchmarks though. So, they are tracking it and they also try to make this kind of code run faster.

ahoge··on RSS: What Not Dying Looks Like
Nah, it's not dying or anything. It just isn't very popular. It never has been. Reader was a niche product.
ahoge··on ECMAScript 6 support in Mozilla
> Not surprising, given Google's stance for other languages.

No, the reason is that Mozilla just added lots of stuff way before it got into the ES specs.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_...

That's from October 2006. It includes things like let/const, generators, iterators, and destructuring assignment.

For reference, ES5 was published in December 2009.

So, it's kinda like applauding Microsoft for supporting text-overflow:ellipsis first. It's something they added with IE6. It became part of the standards much later with CSS3.

ahoge··on JavaScript Promises in Wicked Detail
See slides #19-#28:

https://www.dartlang.org/slides/2013/06/dart-streams-are-the...

It's Dart instead of JS, but the idea is pretty much the same.

← PreviousPage 7 of 16Next →