« Generating ISO metric screw threads | Main | Enabling a 32bit backbuffer on Android devices using Unity 3.4 »

Dart Experiment

I made a small web experiment using Dart to see how suitable the language is for game/graphics/physics programming.

Live demo / GitHub

The demo is an example of point-masses and stick-constraints using the verlet integration; Thomas Jakobsen's excellent article "Advanced Character Physics" introduced me to the concept and got me interested in physics programming several years ago.

I really prefer Dart to Javascript and would love to see it getting adopted by the major browsers. Here is my short wishlist for the Dart team:

Please...

  • get rid of the underscore prefix and introduce a proper "private" keyword
  • optimize the VM for vector algebra and immutable types if you don't want to introduce "value types"
  • integrate WebGL

Here are a couple of things I believe are bugs that I encountered while making the demo:

  • Assigning a variable through a get method actually compiles, for example: instance.getMethod = 5
  • Some expressions are not considered constant and won't compile if used in a static statement, for example: static final var strings = ["hello", "world"] - See the comments

Reader Comments (4)

Constant lists and maps must be be made with a const constructor to be const, meaning that they cannot be modified later. So

static final var strings = const ['hello', 'mars'] should work, I think.

A version with type annotations would be
static final List<String> strings = const <String>['hello', 'mars'];

January 14, 2012 | Unregistered CommenterWilliam Hesse

Thanks for the clarification! I updated the source to account for this.

January 30, 2012 | Registered CommenterGustav Olsson

Hey Gustavo, how are you doing? Sorry about the post here, but I'm trying to contact you at this post: http://forum.unity3d.com/threads/95979-Shatter-Toolkit/page3 and i don't get some answer. Can you repply me by email?

February 17, 2012 | Unregistered CommenterBruno

Just thought I would say that I've replied to the posts in the forum thread. Thanks for letting me know!

June 23, 2012 | Registered CommenterGustav Olsson

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>