Re: [misc] Use prefix in import limited to use only dynamic types?

13 views
Skip to first unread message

Ladislav Thon

unread,
Apr 6, 2012, 7:40:49 AM4/6/12
to andrew mezoni, General Dart Discussion
#import('lib1/library1.dart');
#import('lib2/library2.dart', prefix:'lib2');
...
Element element1 = new Element();      // uses Element from library1
Element element2 = new lib2.Element(); // uses Element from library2

This shouldn't work, as you are refering to Element from lib1 on the left side.
 
lib2.Element element2 = new lib2.Element(); // uses Element from library2

But this should. Can't test now, but this definitely should work.

LT

Chris Buckett

unread,
Apr 6, 2012, 7:43:48 AM4/6/12
to andrew mezoni, General Dart Discussion
Hi

The following code:
#import("Library1.dart");
#import("Library2.dart", prefix:"lib2");

void main() {
  Element element1 = new Element();
  lib2.Element element2 = new lib2.Element();   // using element from Library2
}

works fine for me using editor build 6167.

As Ladislav says, this is the same as your line: 

lib2.Element element2 = new lib2.Element(); // uses Element from library2

What build of Dart are you using?

Cheers,
Chris. 

On 6 April 2012 12:29, andrew mezoni <andrew...@gmail.com> wrote:
var element1 = new Element();      // uses Element from library1
var element2 = new lib2.Element(); // uses Element from library2

Reply all
Reply to author
Forward
Message has been deleted
0 new messages