Created
November 22, 2011 06:05
-
-
Save munificent/1385015 to your computer and use it in GitHub Desktop.
Dart Compilation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| // for details. All rights reserved. Use of this source code is governed by a | |
| // BSD-style license that can be found in the LICENSE file. | |
| // Simple test program invoked with an option to eagerly | |
| // compile all code that is loaded in the isolate. | |
| // VMOptions=--compile_all | |
| class HelloDartTest { | |
| static testMain() { | |
| print("Hello, Darter!"); | |
| } | |
| } | |
| main() { | |
| HelloDartTest.testMain(); | |
| } |
Doesn't print() overwrite window.print() in browser implementations? Why do this?
Author
Yeah, you're correct. In this example the output is stomping on window.print. I asked one of our compiler guys and he says this bug is fixed now. It should be renaming functions that collide with ones on window. (The other option the compiler could take is to wrap everything in a big function. The choice between the two is mostly a performance one and we haven't tried comparing yet.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To everyone checking this out, you can minimize the above all the way down to:
main() => print("hello, Darter!");