I've been playing with #import, and I've found a couple of confusing
things.
Given the file myLibrary.dart
01: #library("wibble");
02: class MyClass() {}
And the file myApp.dart
01: #library("myApp");
02: #import("myLibrary.dart", prefix:"myLib");
03
04: void main() {
05: myLib.MyClass my_class = new myLib.MyClass();
06: }
1. This generates a compilation error pointing at line 05: my_class -
"Unexpected token 'IDENTIFIER' (expected ';')"
Changing lines in app.dart (to remove the prefix) fixes the
compilation error:
02: #import("myLibrary.dart");
05: MyClass my_class = new MyClass();
Question: Should the original code listed above work?
2. the #library statement in myLibrary.dart:01 appears to bear no
reference to the filename / folder location.
- I have found, though, that the #library name is what appears in the
dartEditor, (but you can only view the files that make up that library
if they live in a different folder to the myApp.dart library - I'm
guessing that this a problem with DartEditor, as it doesn't seem to
affect compilation)
Question: Are there any recommendations around the #library names and
how they should relate to filename / folder paths?
Thanks
Chris Buckett.
-----------------------------
http://dartwatch.com
Yes, it is a problem with the Dart Editor. We hope to have it fixed soon.
>
>>
>> Question: Are there any recommendations around the #library names and
>> how they should relate to filename / folder paths?
>
> The #-library directives were added very recently and I would not be
> surprised if they changed. (In particular there seems to be no reason to
> require a #library).
> I wasn't directly involved with the latest revision of the library-syntax,
> but I will try to get more information from those that were on Monday.
> // florian
>>
>> Thanks
>>
>> Chris Buckett.
>>
>> -----------------------------
>> http://dartwatch.com
>
>
>
> --
> Give a man a fire and he's warm for the whole day,
> but set fire to him and he's warm for the rest of his life. - Terry
> Pratchett
>
--
Keerti