Profile cover photo
Profile photo
Dan Grove

Post has attachment
A stunning report from Syria. Incredibly depressing, and totally worth your time to watch it:

Post has attachment

Post has shared content
My highlights of Dart, from initial reading of the language spec.

- Very good, formal language specification since day zero. It has many open issues, the language is still in early stage. Libraries still minimal (didn't look in detail yet).

- Despite its authors (famous language researchers), Dart is not a crazy new sophisticated post-modern revolutionary language; just the opposite it's very pragmatic and familiar, both in the syntax (as I was sure it would be) and conceptually (was not that sure). There's plenty new cool stuff, but all careful additions that fit well in the familiar core and will be very easy to learn.

- Javascript/Java/C/C++/C# developers will pick it up in no time. It's based mostly on Java - a big win. New stuff starts with the expected no-brainers like string interpolation, properties, list and map literals, first-order functions, optional named arguments and default argument values.

- Simple, high-level concurrency without shared state or explicit locks ("isolates" = actor model); the way to go for any new, high-level language. But an isolate is also a unit of memory management: even static data is separate for each spawned isolate. Yeah there's statics including class members, I had bet on a purer approach. But the isolates remove the major problem. Besides concurrency, you can also use isolates for security reasons (run untrusted libraries without sharing static data). Still a compromise, the spec says "static methods are debatable... only retained because programmers are familiar".

- Class-based like I expected. Has interfaces too, like Java's, down to the syntax (another win - why would it be different? N.I.H. clearly not a factor with Dart's design). [Javascript's prototype-based nonsense is a failed experiment.] Reflection will be mirror-based (straight off NewSpeak); there's noSuchMethod() for initial MOP.

- Also like expected, Java-like exception handling but no checked exceptions. [Win one, lose one - I can hear most people saying "Checked exceptions are a failed experiment" - yeah I don't agree, I love checked exceptions, but it's a lost battle. Besides, in a mostly-dynamic/scripting lang it's even harder to justify.]

- The optional static type declarations are complemented by a choice of "production mode" (lenient - ignores type declarations) versus "checked mode" (strict - does runtime checks and throws exceptions for typing errors). But the naming is bad; I can see thousands of PHB's requiring that production apps run in "production mode", never allowing developers/admins to use checked mode in production. Static declarations are considered at compile time, but errors only produce warnings (compromise for Dart's scripting quality... but please, give me a -Werror switch). Also, the lang spec is silent about performance - normal for this kind of doc, but the description of execution modes implies that static type annotations are only useful for development (finds more errors in checked mode), I wouldn't expect that, needs clarification if type annotations may enable extra optimization in either mode.

- Available docs don't make clear if untyped declarations benefit from type inference. I guess Dart will dodge the complexity of a formally-defined type inference system, leaving that as implementation detail for the JIT. This goes well with the dynamic side of the language and keeps flexibility that eases future evolution. But it's expected that tooling will make inference that's visible to the programmer, e.g. for code completion and safe refactoring, so a unambiguous inference spec would be useful even if as a non-normative appendix.

- OO-pure typesystem like I expected. Down to the common catch that numeric types (like al types) are nullable, so initial values are null, not zero. Dart has no nullability in the typesystem, that's my biggest wart with Dart (open issue in the spec... yes, PLEASE do something about it). There are no "primitive" arrays. I guess types like a fixed-size Array<int> will be implemented as simple arrays, specialized per type, with dense layout and no boxing.

- A decent module system ("libraries"), another bet I 'won' easily, considering the language's authors. The import/include declarations use an URI to identify the target library, way cool.

- Only public/private visibility, no other options like protected. No keywords: class members are private if their name starts with '_'. and most surprising, privacy is not class-scoped, it's module-scoped; so this is more similar to Java's package-private. It's a great choice for a scripting language. The leading underscore looks ugly to my Java-addicted eyes but it screams "private" in every reference to the identifier, which is good considering the module scoping. I like it.

- I don't like the rule for abstract classes - can either have the 'abstract' keyword, or be automatically abstract if there's at least one abstract member (C++'s rule, which sucks). This is going a bit too far to make things simple/dynamic/optional.

- Operator overloading! That was a big, welcome surprise. It's a simple implementation - cannot do crazy stuff like inventing new operator names or messing with precedence, also Dart lacks C++ complications like implicit copy constructors or overloaded typecasts; so the operators are pretty sane.

- General support for immutability, with interesting traits like const constructors (which can make constness an instance-level, rather than class-level decision - and also allows the class to not promise executing the constructor or returning a unique object, so it can do some caching or interning). This plays well with the switch statement (can switch on any type), concurrency (possible to avoid cost of copying in messages between isolates), default argument values, and snapshots (suggested technique for faster startup). Value equality (==, !=) is preferred over reference equality (===, !==).

- Constructors can have an initializer list (like C++ but nicer). This is all that a const constructor can have, so it can be evaluated at compile time. There's another special form for factory constructors. Interfaces can declare constructor signatures too! The interface can declare a standard factory class, so you can actually say "new MyInterface(foo, bar)" and this calls the corresponding factory constructor of some concrete class.

- Generic types start very similar to Java, including upper bounds. No lower bounds or wildcards, and only classes/interfaces can declare generic arguments; so it's way simpler than Java. But the choice for co-variant generics (over a fully sound typesystem) will get the purist upper-half of the internet screaming at Dart. We have typedefs, but right now only for function types. "Because type parameters are in scope in their bounds, we support F-bounded quantification (if you don't know what that is, don't ask)" - OK I can take some patronizing humor in a formal spec ;-) - Only two number types: decimal ints (no size limits) and 64-bit IEEE-754 doubles. I failed to guess this one; I expected a full range of numeric types, all way from byte to decimal plus float/double. [Start countdown for Javascript advocates writing microbenchmarks that really depend on typed arrays of Int8 or Float32 to show that JS is faster than Dart.] Good compromise between simple and efficient; considering also the optional static typing, I guess the effort to unbox numbers, and narrow decimals down to more efficient 1/2/4/8-byte ints will be smaller than for Javascript.

- It's so refreshing to read the spec of a C-family language that does NOT support the octal base :) incredible how long some old cruft takes to die. But Dart keeps Java's labels and labeled break/continue; as the spec explains, this is great for tool-generated code like parsers.

- Not a hybrid-functional language, still the immutable data support helps functional idioms. But seriously guys, can we also have tail recursion optimization?

Post has shared content

Post has attachment

I see that one of the top hits for Berlusconi today is in the Washington Post's "Entertainment" section. not too surprising, I suppose!

Post has attachment

the new definition of freedom, as seen on twitter:

21 minutes ago

Post has attachment

Post has attachment
Wait while more posts are being loaded