Showing posts with label errors. Show all posts
Showing posts with label errors. Show all posts

Thursday, March 8, 2012

Darting here and there

So another Dart Editor update, now at Build 5104, get it here!. I love how quickly the dart integrated builds have been coming lately. This new version does away with the old 'Libraries' view panel on the left side (by default) and instead implements a Files view. Instead of opening a project you now open the folder containing your project. All of your .dart files are loaded into that. I wasn't sure about it at first, as it is a changes in how it would work previously but already I'm seeing the benefits of it. It does help to encourage a Good folder/subfolder layout, which I was already comfortable with anyways.

I've seen a few people report some difficulties loading their existing projects, however I can't really comment on that as I have not encountered those issues myself. This version did correct the mass of errors I was receiving in the previous version regarding variables hiding other variables or methods. However it did introduce a couple of new ones.

First, this version introduced the changes to the dart:io library, changing all eventHandlers over to be in the form of onEvent, and one-shot methods (such as File.exists) now take the callback function as an argument, as opposed to having to specify an 'existsHandler'. As such I had to go through my code and made updates to the Sockets and Files to properly reflect the changes to the library.

Secondly, I ran into an issue where any print statements, within a class, would generate an error or warning that "print" is not a method in , where ClassName is whatever class happened to contain the print statement. This post in the Dart Group provided an easy, temporary fix, that is to simply import 'dart:builtin' where required. A simple fix and helped to clean up the errors there so I could focus on my own errors that I had to worry about.

I notice that while the IDE and SDK were updated to Build 5104, the Dartium Build remains at 5070. At this time I am still unable to get the Dartium builds to run on my machine due to a version problem with the shared libraries. I receive the following error:

error while loading shared libraries: libgconf-2.so.4: wrong ELF class: ELFCLASS64

I believe this error is related to the fact that I'm running a 64-bit OS, but it's trying to load 32-bit build. This may also have something to do with my early ventures in trying to build DartVM, IDE, and Dartium myself and installing the extra libraries, etc, which may have conflicted with what Dartium is trying to load. In fact, now that I think of it, I should run a good apt-get autoclean and autoremove regardless. I don't believe it will fix it, but certainly clean up my system a little at least. Now I've not been too worried about this as my current project doesn't use or require any client-side work, but eventually it might be interesting to have a working copy of Dartium for when I start working on some client side projects. Hopefully the 64-Bit builds of Dartium will be available by then.

Monday, March 5, 2012

Dart Mud... Progress 2

So I decided it's time for another progress report on my Dart based MUD. This project has be a lot of fun, and giving me experience with the dart:io libraries including Files, ServerSockets, and Sockets. Before I get into too much, I will mention that there is a new Integrated Dart Build available. Version 4760 (though SDK appears to be build number 4759). You can find your download here. Since using this build I have been getting errors and warnings when using the dart:io library. However it doesn't prevent my project from running properly. Just distracting thinking I have an error when I don't.

To follow up on my previous post, I have begun using git locally to archive changes and keep a bare-bones changelog system. Already I see this being helpful in keeping track of what I have changed or done, and additionally, in being able to revert changes easily. Once I clean up some of the code and add a plethora of comments, I may pop the project up onto Github as well.

My User Object now allows for the creation of a new character, automatic saving of a user and loading user (and password) from a save file. To save character information I'm currently placing the information I want saved into a map, and using saving it as a JSON object. In the future I can see some issues I may need to work out, but since I haven't decided on how things such as Objects, equipment etc will be implemented yet I don't know yet how much of an issue they will be.

As part of adding to the User object, I decided to create a separate Login object as well which will handle the accepting of username/password and loading the character and creating a new User object from the loaded information. Additionally the Login object also handles creating a new account, posing the various questions (username, password, password confirmation etc), then creating a new User object based off of the data provided. This way a full User object isn't created until credentials have been verified, and also prevents User from showing up in the user list, or receiving broadcast messages etc before they have completed the Login process.

As part of the work to separate the Login class from the User class, I also created a separate 'Connection' class as a wrapper over top of the raw sockets. Primarily this just creates a couple of convenience functions over the Socket for write, writeLine, readLine, set the lineHandler and close the Socket. I made this its own library, so it is imported into the Server which creates the initial socket and then wraps the Connection around it, and then hands it off to the mudlib (which is its own library). The mudlib also imports the Connection class. The mudlib then passes the Connection off to a new Login object which uses that to communicate to the user (again as opposed to the raw socket). The connection object is then passed off to the newly created User object once it is created. User object adds a couple more convenience functions as well but mostly works with the Connection object as well.

I've added a couple more commands as well. Now able to 'say' to the local room, change the default prompt (which does save to the User file), and of course the always abused 'emote' command. Additionally I've got a good start on a simple line editor (and a simple command wrapper for it to see the results). The Editor is a separate object which will take over the Input/Output streams of a socket from the user. It does not remove the user itself, nor does it take the user's connection object. Rather it just updates the Connection object to use the Editor's lineHandler.

The editor has two modes, Command mode and input put. By default you start in command mode, from which you can either insert or append which will put you into the input mode. To exit the input mode, one just needs type a period (.) on a blank line. The editor works similarly to 'ed' but a little prettier. (For instance a prompt of ': ' in command mode and prompt of '~ ' in input mode). Currently implemented commands in the editor: a - append, i - insert, q - quit, h - help, p - print line, d - delete line. In the future some commands such as p and d will accept a range argument as well however this is yet not implemented. There is no 'save', if you quit it will return whatever is in the buffer.

The editor is called by the User object. The User object in turn is called by some other command or object (most likely a command which will do something with the output). To start the edit the User object has startEdit method called on it with a callback function as an argument. Once the editor finishes it calls the method doneEdit in the User object which resets the proper line handlers, and then calls the previous callback function with the String returned from the Editor.

When I first started working with the Editor I thought the obvious solution to use it would be a StringBuffer. However after only a few minutes of implementing it with the StringBuffer I found it lacked much of the basic functionality I needed, such as getting a specific line from the buffer, or removing a line from the buffer. I also can only add to the end of the Buffer and not to any particular point in the buffer. So that didn't last long at all.
When I looked at the StringBufferImpl class in the library, I saw that it was nothing more than a List of Strings. So I decided to do the same. So I created two List of strings. One for the full Buffer, and one for a temporary buffer. The temporary buffer is used in input/edit mode. Upon leaving input mode back to command mode then the temporary buffer is inserted into the full buffer.
To accomplish this, I originally tried using List#setRange. However I quickly discovered that wouldn't work as it would just overwrite the range, as opposed to inserting at that point. Additionally if the temporary buffer would exceed the length of full buffer, then it would throw an exception. Even though the list is an extendable list. So I tried List#insertRange, and that expanded the List as required, but it will only initialize the new range to the same value. You can't insert the range with with list as the new values. So it required first using insertRange to add the space for the temporary list, then setRange to change those values to be the strings in the temporary buffer.

Another area of interest is that I have implemented a RoomManager. Eventually the RoomManager will be expanded to have time outs so once a room has gone 'stale' (no activity in it for x number of minutes) it will reset the room. And, if still not used after y number of minutes, the object will be unreferenced for the GC to clean up as it will. The first part of this however, was trying to to determine how I can efficiently 'dynamically' load the rooms when someone tries to access them, or alternatively reference an already loaded room. Since I can't use eval to load a file at this point, the code has to be loaded on start up.
So I created two maps, each map has a key of a room identifier. One map holds the rooms themselves if they are loaded. The other, roomFuncs holds functions which create the room. Rooms are added by calling the add method on the RoomManager, which takes a callback as an argument. The add method then runs the call back to create the room. It gets the room's unique identifier to use as the key. Then it stores the callback in the roomFuncs map. Then when it comes time to access the room, we call the method putIfAbsent method on the room map, passing our roomId and a reference to roomFuncs[roomId] which returns the callback to create the room if the object is not already loaded. The putIfAbsent is a nice little method, and quite handy for this.

Well that's about all for now anyways. I must say I'm having a blast writing this simple mud, and while I have a long way to go for a full featured mud, it is virtually usable at this point. Dart is a lot of fun!

Tuesday, February 7, 2012

Library hide and seek

So today I took some time to start playing with the IO library in Dart. Right off the bat I started running into problems. First off, I'm running Linux 64-bit and I'm using the latest integrated version of the IDE and SDK (Build 3934). Taking a look into the SDK I do see the IO libraries and such so I couldn't wait to get started. My first little script just spawns a new process running and displays the results. In this case in particular I'm spawning an snmpget command to run a quick and simple snmp query.

So I fire off my quick and dirty little script to see if I can get any output. I save my file and... err what what? The editor is giving me a nasty little error. Right there on line one of all places (my library declaration), a few other errors follow as well.
File not found: dart:io

A little further down is:
Multiple markers at this line
  - no matching constructor for Object
  - cannot find type Process

This line is where I make my new Process object using new Process.start(). Based on the first error, I gather that this line is generating an error because the IDE isn't recognizing any class called Process for me to create a new object from so it's trying to use the base Object class, which doesn't contain a named constructor called 'start'.

I mess around in the IDE to verify that the SDK libraries are available and that it is seeing the SDK as installed. Yeah, everything seems hunky-dory there. And... wait... my library panel is displaying the dart:io library right there in the left-hand pane. Something here doesn't seem right at all. I do a quick search in the dartbugs but don't find anything. So I came up with the following quick trial case and submitted a bug report.
#import("dart:io");

void main() {
  print("Hello World");
}

Save the above in the IDE and you should see the error generated at line 1. As I mentioned, I filed a bug report: Issue 1577. At first I thought that would be the end of my trials today, however I hit the run button anyways and low and behold the console is showing expected output. So while the IDE isn't recognizing the library in the editing pane, it is recognizing it in the libraries (though showing errors in it none-the-less) and the dart VM does run the code as expected. Excellent maybe I will get to do some testing after all!

Continued in INs and OUTs of IO.

Monday, January 23, 2012

Wat?

Yesterday, Seth Ladd posted a link to a humorous video which highlights a few WAT?!?! moments in Javascript and Ruby. He then discussed how Dart deals with some of these moments in Javascript WAT moments and Dart. Please watch the video and read Seth's blog prior to reading.

There are WAT moments in virtually every language. A line from the video says something along the lines of So since it is the plus operator, we can expect the same result if we switch the operands around.. In the case of the video it was discussing how Javascript handles adding an array and a hash, and a hash and an array. However this reminded me of the issue I ran into myself already in experimenting with Dart. Look at the following code:
main() {
  print("wat" + 1);
  print(1 + "wat");
}

What is particularly interesting is running this example in the variety of locations. First lets run it from the Dartboard, without checked mode. We get the result:
wat1
1wat

More or less what you'd expect to get adding a string and a number. We do see a little warning off to the side indicating String is not assignable to num. But being not in checked mode it does run and because its Dartboard it falls back to the Javascript implementation of number + string. Well lets see what we'll get in the DartVM...
wat1
Unhandled exception:
NoSuchMethodException - receiver: 'wat' function name: 'addFromInteger' arguments: [1]]
 0. Function: 'Object.noSuchMethod' url: 'bootstrap' line:360 col:3
 1. Function: 'IntegerImplementation.+' url: 'bootstrap_impl' line:1469 col:32
 2. Function: '::main' url: '/home/mbutler/dart/Test/Test.dart' line:3 col:11

Err WAT? Even more, that runtime error is.. far from clear on just what exactly is going on. Additionally in the VM we do get the same warning as stated above, on the line with the issue so that helps to track it down easy enough. Well lets go back to the dartboard and enable checked_mode:
wat1
Failed type check: type String is not assignable to type Number

Well that's kind of a reasonable error. Must get the same in the Dart VM using the 'enable_type_checks' flag.
wat1
Unhandled exception:
'bootstrap_impl': Failed type check: line 1468 pos 22: type 'OneByteString' is not assignable to type 'num' of 'other'.
 0. Function: 'IntegerImplementation.+' url: 'bootstrap_impl' line:1468 col:22
 1. Function: '::main' url: '/home/mbutler/dart/Test/Test.dart' line:3 col:11

Okay WAT? That error is almost as long as the first one but its a little more obscure I think. I see from the very last line of the error where the issue is in my code (I notice this now in the first error as well. I'm so used to seeing my code point at the top of the error with subsequent library calls following after that, that I didn't realize to look at the bottom of the error for my error). But the error itself is interesting "OneByteString" is not assignable to type "num" of "other"...? Of other what? String not assignable to num is understandable though not necessarily expected. But of other? I'm not sure. Just rambling a little bit at this point as well as I procrastinate getting some work done in the office today.

I'll post again later today if I get the opportunity as Seth has a couple of other blog posts written that I want to follow up on. Particularly on his one about 'this'.

Wednesday, January 18, 2012

A List of Errors.

Before I get started on this post on Lists (actually, I already started it yesterday but didn't complete it yet ;), I did want to share the information that Seth Ladd recently shared regarding the Dart issue tracker. Sometimes it can be hard to locate or you just can't recall the location to access the tracker. Well never fear! There is a new redirect URL available to use.
dartbug.com
Redirects to the main issue list.
dartbug.com/new
Redirects to the new issue template.
dartbug.com/1199
Redirects to a specific issue number (in this case 1199, the one I submitted and mentioned in my last blog post).
So I'm continuing with Seth Ladd's series on Dart. Today I'm looking at Lists and Arrays. One particular quote from the post particularly grabbed my attention and interest:
Fun fact: As of 2011-12-22, the word "array" does not appear in the Dart spec.'
This interested me as virtually all languages have arrays and refer to them as such. But sure enough a quick search through the current language spec reveals no results for 'array'. Now, as stated in Seth's blog, Dart arrays are Lists. I found it an interesting point none the less.

Interestingly enough however, the VM does output an error which refers to arrays. But when compiled to Javascript (via frog or dartc) the errors properly reflects 'lists'. First I'll demonstrate the code and error then I'll actually provide some additional comments regarding the code.
main() {
  var list = new List(3); // Create an immutable, or 'non-extendable' list
  list.add(4); // Now try to change it (extend it).
}

This results in the following error:
Unhandled exception:
UnsupportedOperationException: Cannot add to a non-extendable array

But when executed on the dartboard we get the following error:
UnsupportedOperationException: Cannot add to a non-extendable list

It surprises me a little that the VM does specifically reference array whereas the code compiled to Javascript, which does have arrays, correctly references a list. There already exists a couple of bug reports. One which I'll only briefly mention, indicates that the word 'array' should be removed from all internal libraries. The second, which I added a comment to regarding the VM specifically is: Issue 1028. This issue aims to be more encompassing removing references from the Libraries as all references which may become visible.

So you may be wondering why it is that List provides an add method if it just generates an error. Well that's because there are two types of lists. A 'non-extendable' list which is created by passing a size to the constructor, or you can create a list without the optional argument to the constructor which creates an empty list you can extend by adding (or removing) values from. An extendable list can also be created from a list literally such as:
var list = [1, 2, 3];

Note however, that unlike some other languages (such as Ruby), you can not call a method on the List literal. Thus the following is not valid code:
var list = [1, 2, 3].add(4);

You'll receive a warning indicating "expression does not yield a value". But it will compile and run (at least until you try to call a List method on list such as length which will generate a runtime error.

However there is a bug in the add method which I have just discovered. The API for List.add indicates that the return type is 'void' (or no return value). This works as expected in the dartboard (javascript). However in the Dart VM, list.add(value) returns the new size of the list. I have submitted a bug report for it here: Issue 1213.

Monday, January 16, 2012

Not named?

So as my previous post mentioned I now have the dart VM compiled and running. However, now I'm running into something new I didn't expect. Apparently the dartVM (from trunk) doesn't recognize the named function parameters as expected, or at all. Seth Ladd's blog post about Learning Functions for Dart explicitly states that optional function parameters can be named. Regardless of how I format the function and calling functions, I am receiving the error:
...unexpected token ':'

This is a little confusing as, while I realize I'm not using the bleeding_edge version of the VM, but it shouldn't be that old. Here's a link to the code I'm using http://try.dartlang.org/s/cgIo (it does work as expected in dartboard).
hello(msg, to, [from, rate]) => '${from} sent ${msg} to ${to} via ${rate}';

main() => print(hello('world', 'Seth', from:'Bob', rate:'First Class'));

Results on Dartboard:
Bob sent world to Seth via First Class

And the results in the VM (from both the dart editor console and from command line):
/home/mememe/dart/Test/Test.dart': Error: line 3 pos 44: unexpected token ':'
main() => print(hello('world', 'Seth', from:'Bob', rate:'First Class'));

Additionally. For some reason in the Dart Editor, if I highlight all my code and copy it and paste it else-where, when I come back to the Dart Editor and unselect the code (but make no changes to it), I can no longer click on "Launch in Dart Server" the icon becomes greyed out and I can't run the code from within the editor again until I close out of the editor and re-launch it. Again this is using Dart editor build: 3331.

I'll take some more time tomorrow to play around with the Dart editor and see if I can verify specifically what causes me to no longer be able to run the code in the server. (No amount of saving, or editing the code will restore the functionality that I've seen so far, short of closing out entirely).

Dart VM Install?.... Yes!

Firstly, allow me to comment that I have been corrected in how Dartboard works. In my post That's a Type of what?, I made mention that I believed that the Dartboard sends code to the server and is executed in the DartVM and the results are displayed back. I have found out that this is incorrect and in actuality the code is sent to the server which is compiled into JavaScript and then sent back to be executed client side. This is what results in the type confusions.

So to circumvent this confusion going forward I am going to work on today on downloading and compiling the dart VM. I will keep information throughout the day on how this process goes and any issues I may run into.
  • Step one: Install the the 32-bit libraries on my 64-bit machine. Following the automated setup instructions (very handy I might add). Running the install-build-deps.sh script is pretty quick and extremely handy. Though the initial question about installing the debugging symbols is a little poorly worded. I wasn't sure if I was being prompted to install the debugging symbols or all the packages. Hitting "N" I receive the message that it will not install the debugging symbols and starts to proceed with the installation of other packages (after asking me for a sudo password).
  • Step one (b): I'm prompted if I want to install the gold linker, which is apparently 5x faster than regular ld.. yeah sure why not. Lots of building and such occurs. No errors encountered that I notice. I wonder will the system detect this is installed automatically or will I have to pass that as an optional parameter myself? We'll see..
  • Step one (c): I'm prompted if I want to install the 32-bit dev libraries to build a 32-bit chrome on a 64-bit system that it will need to download a large number of debs then will extract the files it requires, create new debs and install them (and, one assumes, will remove the larger and more numerous original debs)... wait I thought this is what I was doing already anyways? Re-reading the Preparing Your Machine wiki again says that you may need to install the 32-bit libraries on a 64-bit system. Better hit yes just to be on the safe side
  • Righty, all done that... I notice it left a binutils-2.21.1 directory there... might need to get rid of that later. On to the next part, check out the code. Copy and paste.... and done. And export the path.. Oo no compiling this time yay.
  • Okay, now onto Getting the Source. Now I'm stuck with a choice... do I get 'everything' or do I get the standalone VM? I already have the Dart Editor installed. A little confused as to what additional packages there are to install. Does this install Dartium too? I kinda assume frogc was part of the VM package... well I've got a fair bit of space to install... might as well go ahead and do 'everything', to save me from having to come back and look for them after the fact if I did decide I wanted something else.
  • gclient sync ran into an issue... exited with a non-zero status code. I see a notice that I can't download DumpRenderTree. I'm advised to run a script gsutil config... yeah okay. Enter in the authorization code... blank project-id.. Okay done now...? Well lets try running gclient sync again. Uhm... ends saying Syncing projects: 85% done. I dunno did this work or not? Well only one way to find out. Time to try and build.
  • Building everything: Alright... into the dart directory and run the build... odd that I have to specify my arch as a 32 bit system. A quick groups search shows me that the 64-bit system isn't yet implemented. Hopefully that will change in the future, particularly as server side code starts rolling out. Looks like this may take a while. So I'm going to grab some lunch. -- Back from lunch and it appears that the build failed. Getting an error "Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar" A quick google search shows I'm missing the openjdk-6-jdk package. I look where it expected to find the file and it only shows jre directory and such no lib directory. Quick apt-get install openjdk-6-jdk installs this for me. I double check and the file is where it expects. Still... odd though that it wasn't detected with the build deps.
    And bang, another error... This one a little more complex. Lots of information on the screen but it really boils down to this line: "runtime/vm/dart_api_impl_test.cc:1432:15: error: variable ‘result’ set but not used [-Werror=unused-but-set-variable]" Doing some looking around I see a few similar errors though not specifically that file/line. I double check the file and see the declaration and assignment to that variable but not used after that. Not passed or returned apparently. Odd. I double check the source online in both trunk and bleeding_edge. Both are showing the same thing. Looks like I have resort to the work around. I know right away that the work around will fix that error as the work around makes warnings just warnings and stops them from being errors. The work around is comment 8 as seen here.
  • Building has finished apparently, though I can't seem to see the Dartium build in there anywhere. But in anycase lets start with the testing... Oh look an error doesn't like the Chromium testing. Okay we'll just drop that part. Progressing VERY slowly for these tests. A few of them have timed out so far, haven't reached the results yet. Starting to think about if I really need the "All" option. Doesn't appear to have compiled the editor either (which isn't a big deal since I already have that downloaded from the dartlang page anyways.)
  • Eventually my tests finally complete (well over an hour). And I, for reasons I'm still not 100% sure of, decide in my infinite wisdom, decide "No, I only want the standalone VM". So I remove all the sources and start basically from the beginning. First I check out the "standalone.deps" and sync.
  • Now to build again. This time however I also make note to build as a release instead of as debug which is the default. Now to go through the similar steps to build (such as disabling warnings as errors on the compiler). Build is pretty quick. Now tests... wow much faster as well. None time out this time either.
Alright, so now that I have that downloaded and compiled lets give it a try right quick. Yep a simple "hello world" works exactly as expected from the command line. However when I try to run a test in the Dart Editor it just wants to compile it doesn't want to use the VM even after specifying the path.

Upon investigation I do see that there is a new Dart editor release available. I was previously using 3101. Latest build number shows 3331. I try downloading the latest stable release and sure enough it's the 3331 release. One really nice enhancement is that it allows you to decide when making an app if the application type is Web or a script. Choosing script, and having the VM path set automatically runs the examples in the console as well! Success!

In addition. Running the small little script from my previous post gives the following results:
true
true
false
false
false
false

Exactly what we would expect to see. Phew. So now as I progress learning the language I can use the dart VM directly as opposed to running in dartboard all the time. Should help my work flow as well.

Current I only have the dart VM running and did not bother with the compiler, Dartium, etc. I am curious for those of you familiar. Since Frog is written in Dart, does it require the compiler aspect to be compiled or will it work with just the VM as is?
Also for the Dartium build.. the Wiki instructions show to use bleeding_edge repository as opposed to using the trunk. Thoughts on this?

Friday, January 13, 2012

That's a type of what?

So I'm playing around with the Dartboard again this morning. Firstly, dartboard is purportedly an interface which sends the Dart code to the dart VM on a server, and displays to output, as opposed to compiling the script to javascript. This is of particular note, as I will mention briefly.

First, the code. Here's the link: http://try.dartlang.org/s/csQn

main() {
  int x = 10;
  double y = 10.3282;
  print(x is Dynamic);
  print(x is num);
  print(x is double); // Int is a double? (plausible granted)
  print(y is int); // Double is an int?? (bye bye precision?)
  print(x is bool);
  print(y is bool);
}

And the results:
true
true
true
true
false
false

That's right. Not only is an int a double, but a double is an int. I previously mentioned the fact that we are supposed to be connected to the dart VM through the dartboard is of significance, as this topic has come up within the dart groups. In particular, Peter Ahé mentions:
Dart is a new programming language. If you want to see it as we intended it to work, use the Dart VM.

On the Dart VM, int and double are different.

Now I realize that Dart is 1) still a new language under development and has bugs still to be worked out and 2) Primarily designed to be a dynamic language. However I can see issues arising from this in a few special cases. Additionally, based on Seth Ladd's blog post:
The is check is not affected by the declared types, instead it is checking what the type of the variable actually is.
Unfortunately at this time I do not have the Dart VM compiled and installed on my local machine which is why I've been relying on the dartboard for the time being. If anyone has the VM installed please try running the above and let me know if your results differ.

Thursday, January 12, 2012

Ranting Runtime

So to start things off, I decided I would look at a slice of code I had an issue with yesterday. Now first off know that the error in the following code was entirely intentional. I was looking to see how dart, and Dartboard would handle various errors. Looking to see if I would receive a warning, error or runtime error.

First a link to the dartboard (and I'll paste the code in as well until I can figure out how to embed the dartboard into here).

class States {
  static final ON = 1;
  static final OFF = 0;
}

main() {
  var test = new States();
  print('Give try.dartlang.org a try.');
  print('On is: ${States.ON}');
  if(test is States) print('Test is a State instance');
  // The following never prints?
  print('test.ON is: ${test.ON}');
}

Which produces the following output:

Give try.dartlang.org a try.
On is: 1
Test is a State instance

That's it.. no error, no warning. Just did not ever print anything from the final statement. That struck me as really weird. But what I figured was probably happening is that dartboard was receiving a runtime error but didn't display it at all. Still it seemed off to me.

However, after writing a post on Google+, later in the day the dartboard did start reporting the runtime error that was being generated and produced the following:

NoSuchMethodException - receiver: '' function name: 'ON$getter' arguments: []]

Yay! Errors... but errr huh? NoSuchMethodException.. yeah okay I can see that, it's looking for getter method for a class property. But why is the receiver blank? Receiver should be the 'test' instance of the States class. And the arguments are... err what? Okay I can see maybe showing an empty array for the arguments (thus the '[ ]' ) but why am I seeing the extra ']' ? But I well realize that the VM is still in alpha. I've not had a chance yet to go through the issue trackers to see if these are known bugs but being that they are so prominent I have reason to believe they are.