[haxe][import] shortcuts

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[haxe][import] shortcuts

bubblebenj
I don't know If it's a bug or not, however when using this king of pattern discribed in 

Shortcuts

One commonly-used pattern of modules is to declare all the data structures that you need in a single module, so you can have them accessible with a single import.

Another pattern is to a create a module that only declares typedefs to make shortcuts for otherwise long-to-write types, for instance in Flash :

// module FastFlash.hx
typedef MC = flash.display.MovieClip;
typedef SPR = flash.display.Sprite;
typedef BMP = flash.display.BitmapData;
typedef EV = flash.display.Event;
// etc.

Then you can simply do :

import FastFlash;
class Button extends SPR {
    var animate : MC;
    //...
}
(At least in FD) If you don't have imported FastFlash module yet and you type directly
var animate : MC
Completion propose the MC class as expected but doesn't had the import correctly (actually doesn't import anything) and it's actually displayed as my_package.MC (my_package being the package of FastFlash).

Since FD completion is linked to the haxe compiler, I'm not sure where is the good place to report that.

Ben

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [import] shortcuts (FlashDevelop bug)

Nicolas Cannasse
Le 17/08/2011 11:31, benjamin Dubois a écrit :
> I don't know If it's a bug or not, however when using this king of
> pattern discribed in
> http://haxe.org/manual/modules
[...]

> (At least in FD) If you don't have imported FastFlash module yet and you
> type directly
>
> var  animate : MC
>
> Completion propose the MC class as expected but doesn't had the import
> correctly (actually doesn't import anything) and it's actually displayed
> as my_package.MC (my_package being the package of FastFlash).
>
> Since FD completion is linked to the haxe compiler, I'm not sure where
> is the good place to report that.

This is a FlashDevelop issue, since the compiler is not used when
automatically adding imports.

@Philippe : maybe you could track the module in which the type has been
declared ?

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [import] shortcuts (FlashDevelop bug)

Elsass Philippe
Nicolas, Benjamin,

Modules are not really supported by FlashDevelop currently so
auto-import won't work - that's actually a pretty weird feature of
haxe and it will require some modifications to the completion model.

BTW I'd love to have your input on the most appropriate auto-import
behavior we should add - like defaulting to importing the whole module
or only each definition from the module.

Since modules were clarified in the wiki it's now on top of my TODO
list so it will most likely be fixed soon.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [import] shortcuts (FlashDevelop bug)

jlm@justinfront.net
Did flashdevelop get anywhere with mac support, I read some snipits  
from the forum, but I guess there are no solid plans?

Cheers ;j


On 17 Aug 2011, at 21:31, Elsass Philippe wrote:

> Nicolas, Benjamin,
>
> Modules are not really supported by FlashDevelop currently so
> auto-import won't work - that's actually a pretty weird feature of
> haxe and it will require some modifications to the completion model.
>
> BTW I'd love to have your input on the most appropriate auto-import
> behavior we should add - like defaulting to importing the whole module
> or only each definition from the module.
>
> Since modules were clarified in the wiki it's now on top of my TODO
> list so it will most likely be fixed soon.
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [import] shortcuts (FlashDevelop bug)

Achmad Aulia Noorhakim
AFAIK, no native OSX (or Linux for that matter). Only improved integration with VMware/VirtualBox and/or WINE (Linux).

On Thu, Aug 18, 2011 at 4:52 AM, [hidden email] <[hidden email]> wrote:
Did flashdevelop get anywhere with mac support, I read some snipits from the forum, but I guess there are no solid plans?

Cheers ;j



On 17 Aug 2011, at 21:31, Elsass Philippe wrote:

Nicolas, Benjamin,

Modules are not really supported by FlashDevelop currently so
auto-import won't work - that's actually a pretty weird feature of
haxe and it will require some modifications to the completion model.

BTW I'd love to have your input on the most appropriate auto-import
behavior we should add - like defaulting to importing the whole module
or only each definition from the module.

Since modules were clarified in the wiki it's now on top of my TODO
list so it will most likely be fixed soon.

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [import] shortcuts (FlashDevelop bug)

Alex Liebert
As I understand it it's a major undertaking because of the number of Windows-specific UI calls and etc.  I think they're actively looking for volunteers though!  And donations.

On Wed, Aug 17, 2011 at 7:19 PM, Achmad Aulia Noorhakim <[hidden email]> wrote:
AFAIK, no native OSX (or Linux for that matter). Only improved integration with VMware/VirtualBox and/or WINE (Linux).


On Thu, Aug 18, 2011 at 4:52 AM, [hidden email] <[hidden email]> wrote:
Did flashdevelop get anywhere with mac support, I read some snipits from the forum, but I guess there are no solid plans?

Cheers ;j



On 17 Aug 2011, at 21:31, Elsass Philippe wrote:

Nicolas, Benjamin,

Modules are not really supported by FlashDevelop currently so
auto-import won't work - that's actually a pretty weird feature of
haxe and it will require some modifications to the completion model.

BTW I'd love to have your input on the most appropriate auto-import
behavior we should add - like defaulting to importing the whole module
or only each definition from the module.

Since modules were clarified in the wiki it's now on top of my TODO
list so it will most likely be fixed soon.

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [import] shortcuts (FlashDevelop bug)

Nicolas Cannasse
In reply to this post by Elsass Philippe
Le 17/08/2011 22:31, Elsass Philippe a écrit :
> Nicolas, Benjamin,
>
> Modules are not really supported by FlashDevelop currently so
> auto-import won't work - that's actually a pretty weird feature of
> haxe and it will require some modifications to the completion model.

Well it's not that weird : most of modern PL have some kind of module
system ;)

I was thinking it would be not too hard to add a "module" field to the
type informations collected by FD and import the module instead of
importing the type itself (while in AS3 you'll always have type==module).

> BTW I'd love to have your input on the most appropriate auto-import
> behavior we should add - like defaulting to importing the whole module
> or only each definition from the module.

So far I have disabled auto-import, in particular because I prefer
qualified names instead of import shorcuts.

I guess importing the whole module is not an issue : if people care
about namespace pollution they would not use auto-import anyway ;)

> Since modules were clarified in the wiki it's now on top of my TODO
> list so it will most likely be fixed soon.

Great ;)

Any plans to refactor the horrible ASFileParser BTW ? That would be
needed to improve haXe support by better supporting the language syntax.

Best,
Nicolas



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [import] shortcuts (FlashDevelop bug)

Elsass Philippe
In reply to this post by Nicolas Cannasse
Sure I think supporting modules is a reasonnable improvement.

> Any plans to refactor the horrible ASFileParser BTW ? That would be
> needed to improve haXe support by better supporting the language syntax.
If someone contributes a better parser I'll be happy to integrate it...

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [import] shortcuts (FlashDevelop bug)

Nicolas Cannasse
Le 18/08/2011 10:58, Elsass Philippe a écrit :
> Sure I think supporting modules is a reasonnable improvement.
>
>> Any plans to refactor the horrible ASFileParser BTW ? That would be
>> needed to improve haXe support by better supporting the language syntax.
> If someone contributes a better parser I'll be happy to integrate it...

There's one written in haXe if you want :) you only have to port it to
C#, or maybe ask Cauê to send you to a haXe-2-C# conversion that you can
fix by-hand afterwards :)

http://haxe.googlecode.com/svn/other/as3hx/

Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [import] shortcuts (FlashDevelop bug)

Michael Cann
Sorry to post-resurrect, but has there been any development on this?

Its super annoying not having auto import for classes within modules, particularly when you are trying to explore a new library.

I may be willing to have a go if not..

On 18 August 2011 10:05, Nicolas Cannasse <[hidden email]> wrote:
Le 18/08/2011 10:58, Elsass Philippe a écrit :

Sure I think supporting modules is a reasonnable improvement.

Any plans to refactor the horrible ASFileParser BTW ? That would be
needed to improve haXe support by better supporting the language syntax.
If someone contributes a better parser I'll be happy to integrate it...

There's one written in haXe if you want :) you only have to port it to C#, or maybe ask Cauê to send you to a haXe-2-C# conversion that you can fix by-hand afterwards :)

http://haxe.googlecode.com/svn/other/as3hx/

Nicolas


--
haXe - an open source web programming language
http://haxe.org



--
Mike Cann
http://www.mikecann.co.uk/


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [import] shortcuts (FlashDevelop bug)

Elsass Philippe
In reply to this post by Nicolas Cannasse
Fixing this is a somewhat high priority so it's going to happen "soon".

Sorry to post-resurrect, but has there been any development on this?

Its super annoying not having auto import for classes within
modules, particularly when you are trying to explore a new library.

I may be willing to have a go if not..

--
haXe - an open source web programming language
http://haxe.org