2.06 Invalid field access : new

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

2.06 Invalid field access : new

Robert Sköld
Hey all,

Yay a the new version!

However, after compiling it I get these errors while running haxelib or haxedoc:

buster:~ slaskis$ haxelib
Called from StringTools.hx line 33
Uncaught exception - Invalid field access : new
buster:~ slaskis$ haxedoc
Called from neko/NativeString.hx line 27
Uncaught exception - Invalid field access : new


Simply running 'haxe' gives me the help menu as expected, but while trying to build an old project using 'haxe build.xml' i get this (same) error:

Called from StringTools.hx line 33
Uncaught exception - Invalid field access : new
Error :

Any idea why i get these? And how could i debug it further? I've tried to use gdb on it but it doesn't seem to work very well with the neko executables...

Thanks!

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

Re: 2.06 Invalid field access : new

Daichi Shinozaki-3
Hi,

I got same errors on my linux box.

Maybe you need to uninstall the current haxe installation first,
then build and install the v2.06 haxe executable to /usr/bin(or
/usr/local/bin) directory, then copy the haxe standard
libraries(haxe/std/*) to /usr/lib/haxe (or /usr/local/lib/haxe),
then build the haxedoc and haxelib using installed /usr/bin/haxe.

First I was trying to build the haxedoc and haxelib before deploying the
haxe executable( to /usr/bin/) and standard libraries(to /usr/lib/haxe/),
but got the same errors as you reported.

I don't have any ideas why this occured (and why fixed).

(2010/08/16 16:18), Robert Sköld wrote:

> Hey all,
>
> Yay a the new version!
>
> However, after compiling it I get these errors while running haxelib or haxedoc:
>
> buster:~ slaskis$ haxelib
> Called from StringTools.hx line 33
> Uncaught exception - Invalid field access : new
> buster:~ slaskis$ haxedoc
> Called from neko/NativeString.hx line 27
> Uncaught exception - Invalid field access : new
>
>
> Simply running 'haxe' gives me the help menu as expected, but while trying to build an old project using 'haxe build.xml' i get this (same) error:
>
> Called from StringTools.hx line 33
> Uncaught exception - Invalid field access : new
> Error :
>
> Any idea why i get these? And how could i debug it further? I've tried to use gdb on it but it doesn't seem to work very well with the neko executables...
>
> Thanks!
>
> /r


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

Is there any way to define utility functions in haXe? (similar to flash.net.navigateToURL, etc)

singmajesty
In reply to this post by Robert Sköld

Hi again,

I have a variety of utility functions I wrote in AS3 that I use all the  
time. I'm wondering if its possible to do this with haXe?

Here's an example:




package com.eclecticdesignstudio.utils {



public function ExampleFunction (output:String):void {

trace (output);

}


}




First off, it seems like haXe isn't cool with importing something that  
starts with a lower-case letter. Secondly, I'm not sure how I would  
replicate this structure (or if its possible?)



Thanks!

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

Re: Is there any way to define utility functions in haXe? (similar to flash.net.navigateToURL, etc)

Lyndon Howie
I think that haxe doesn't support functions that aren't part of a class. Also haxe enforces that class names must start with a capital letter (and package names must be lowercase i think) so that may be related to the error you're getting.
To get a similar structure of utility functions, you can declare the functions as static inside a class. It's a little extra typing as you have to call the functions with the class name attached eg. Utils.exampleFunction(); but it helps keep the global space cleaner :)

--- On Mon, 16/8/10, Joshua Granick <[hidden email]> wrote:

> From: Joshua Granick <[hidden email]>
> Subject: [haXe] Is there any way to define utility functions in haXe? (similar to flash.net.navigateToURL, etc)
> To: "The haXe compiler list" <[hidden email]>
> Received: Monday, 16 August, 2010, 6:03 PM
>
> Hi again,
>
> I have a variety of utility functions I wrote in AS3 that I
> use all the time. I'm wondering if its possible to do this
> with haXe?
>
> Here's an example:
>
>
>
>
> package com.eclecticdesignstudio.utils {
>
>
>
> public function ExampleFunction (output:String):void {
>
> trace (output);
>
> }
>
>
> }
>
>
>
>
> First off, it seems like haXe isn't cool with importing
> something that starts with a lower-case letter. Secondly,
> I'm not sure how I would replicate this structure (or if its
> possible?)
>
>
>
> Thanks!
>
> --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: Is there any way to define utility functions in haXe? (similar to flash.net.navigateToURL, etc)

jlm@justinfront.net
In reply to this post by singmajesty
I would use static functions and then you can almost use them like  
prototypes with using. Classes need to start with an upper case.

On 16 Aug 2010, at 09:03, Joshua Granick wrote:

>
> Hi again,
>
> I have a variety of utility functions I wrote in AS3 that I use all  
> the time. I'm wondering if its possible to do this with haXe?
>
> Here's an example:
>
>
>
>
> package com.eclecticdesignstudio.utils {
>
>
>
> public function ExampleFunction (output:String):void {
>
> trace (output);
>
> }
>
>
> }
>
>
>
>
> First off, it seems like haXe isn't cool with importing something  
> that starts with a lower-case letter. Secondly, I'm not sure how I  
> would replicate this structure (or if its possible?)
>
>
>
> Thanks!
>
> --
> 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: Is there any way to define utility functions in haXe? (similar to flash.net.navigateToURL, etc)

Antoine Gersant
Yup, static functions are the way to go. Here's what it looks like :

package somePackage;

class Utils {

     function new () : Void {}
     static public function exampleFunction (s : String) : Void {
         trace(s);
     }

}

And then you can use it in other classes by writing
Utils.exampleFunction ("blablablabla");
(Don't forget to import the Utils class).


Le 16/08/2010 10:14, [hidden email] a écrit :

> I would use static functions and then you can almost use them like
> prototypes with using. Classes need to start with an upper case.
>
> On 16 Aug 2010, at 09:03, Joshua Granick wrote:
>
>>
>> Hi again,
>>
>> I have a variety of utility functions I wrote in AS3 that I use all
>> the time. I'm wondering if its possible to do this with haXe?
>>
>> Here's an example:
>>
>>
>>
>>
>> package com.eclecticdesignstudio.utils {
>>
>>
>>
>> public function ExampleFunction (output:String):void {
>>
>> trace (output);
>>
>> }
>>
>>
>> }
>>
>>
>>
>>
>> First off, it seems like haXe isn't cool with importing something
>> that starts with a lower-case letter. Secondly, I'm not sure how I
>> would replicate this structure (or if its possible?)
>>
>>
>>
>> Thanks!
>>
>> --
>> 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: Is there any way to define utility functions in haXe? (similar to flash.net.navigateToURL, etc)

singmajesty
If I start to use haXe more, and require more of my utility classes, I  
guess that will be the way to go.

I wish I didn't have to, though. I have a lot of utility methods, and I'd  
love not to have to import them all at once. I guess I'll have to try and  
figure out a way to divide them up, based on whether they're for strings,  
Away3D, etc.



On Mon, 16 Aug 2010 02:22:35 -0700, Antoine Gersant  
<[hidden email]> wrote:

> Yup, static functions are the way to go. Here's what it looks like :
>
> package somePackage;
>
> class Utils {
>
>      function new () : Void {}
>      static public function exampleFunction (s : String) : Void {
>          trace(s);
>      }
>
> }
>
> And then you can use it in other classes by writing  
> Utils.exampleFunction ("blablablabla");
> (Don't forget to import the Utils class).
>
>
> Le 16/08/2010 10:14, [hidden email] a écrit :
>> I would use static functions and then you can almost use them like  
>> prototypes with using. Classes need to start with an upper case.
>>
>> On 16 Aug 2010, at 09:03, Joshua Granick wrote:
>>
>>>
>>> Hi again,
>>>
>>> I have a variety of utility functions I wrote in AS3 that I use all  
>>> the time. I'm wondering if its possible to do this with haXe?
>>>
>>> Here's an example:
>>>
>>>
>>>
>>>
>>> package com.eclecticdesignstudio.utils {
>>>
>>>
>>>
>>> public function ExampleFunction (output:String):void {
>>>
>>> trace (output);
>>>
>>> }
>>>
>>>
>>> }
>>>
>>>
>>>
>>>
>>> First off, it seems like haXe isn't cool with importing something that  
>>> starts with a lower-case letter. Secondly, I'm not sure how I would  
>>> replicate this structure (or if its possible?)
>>>
>>>
>>>
>>> Thanks!
>>>
>>> -- haXe - an open source web programming language
>>> http://haxe.org
>>
>>
>
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
Joshua Granick
Owner / Lead Developer
[ eclecticdesignstudio ]
P: (916) 889-7306

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

Re: Is there any way to define utility functions in haXe? (similar to flash.net.navigateToURL, etc)

Baluta Cristian
What i've done to avoid importing is to put them all in a separate folder and i tell the compiler to look there. i have no packages, i simply access them by their name. I rarely use the "using" feature.

On Mon, Aug 16, 2010 at 12:35 PM, Joshua Granick <[hidden email]> wrote:
If I start to use haXe more, and require more of my utility classes, I guess that will be the way to go.

I wish I didn't have to, though. I have a lot of utility methods, and I'd love not to have to import them all at once. I guess I'll have to try and figure out a way to divide them up, based on whether they're for strings, Away3D, etc.




On Mon, 16 Aug 2010 02:22:35 -0700, Antoine Gersant <[hidden email]> wrote:

Yup, static functions are the way to go. Here's what it looks like :

package somePackage;

class Utils {

    function new () : Void {}
    static public function exampleFunction (s : String) : Void {
        trace(s);
    }

}

And then you can use it in other classes by writing Utils.exampleFunction ("blablablabla");
(Don't forget to import the Utils class).


Le 16/08/2010 10:14, [hidden email] a écrit :
I would use static functions and then you can almost use them like prototypes with using. Classes need to start with an upper case.

On 16 Aug 2010, at 09:03, Joshua Granick wrote:


Hi again,

I have a variety of utility functions I wrote in AS3 that I use all the time. I'm wondering if its possible to do this with haXe?

Here's an example:




package com.eclecticdesignstudio.utils {



public function ExampleFunction (output:String):void {

trace (output);

}


}




First off, it seems like haXe isn't cool with importing something that starts with a lower-case letter. Secondly, I'm not sure how I would replicate this structure (or if its possible?)



Thanks!

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




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


--
Joshua Granick
Owner / Lead Developer
[ eclecticdesignstudio ]
P: (916) 889-7306


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



--
Băluță Cristian
http://ralcr.com
http://imagin.ro

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

Re: Is there any way to define utility functions in haXe? (similar to flash.net.navigateToURL, etc)

Tarwin Stroh-Spijer
I think the problem might be that you want to put all your utility functions together. Generally they should be in separate classes that define their use. Good examples are the ArrayTools and StringTools classes.

I do have a general PhpTools class so I know what you're talking about but look at how you can separate.


Tarwin Stroh-Spijer
_______________________

Touch My Pixel
http://www.touchmypixel.com/
phone: +61 3 8060 5321
_______________________


On Mon, Aug 16, 2010 at 7:47 PM, Baluta Cristian <[hidden email]> wrote:
What i've done to avoid importing is to put them all in a separate folder and i tell the compiler to look there. i have no packages, i simply access them by their name. I rarely use the "using" feature.


On Mon, Aug 16, 2010 at 12:35 PM, Joshua Granick <[hidden email]> wrote:
If I start to use haXe more, and require more of my utility classes, I guess that will be the way to go.

I wish I didn't have to, though. I have a lot of utility methods, and I'd love not to have to import them all at once. I guess I'll have to try and figure out a way to divide them up, based on whether they're for strings, Away3D, etc.




On Mon, 16 Aug 2010 02:22:35 -0700, Antoine Gersant <[hidden email]> wrote:

Yup, static functions are the way to go. Here's what it looks like :

package somePackage;

class Utils {

    function new () : Void {}
    static public function exampleFunction (s : String) : Void {
        trace(s);
    }

}

And then you can use it in other classes by writing Utils.exampleFunction ("blablablabla");
(Don't forget to import the Utils class).


Le 16/08/2010 10:14, [hidden email] a écrit :
I would use static functions and then you can almost use them like prototypes with using. Classes need to start with an upper case.

On 16 Aug 2010, at 09:03, Joshua Granick wrote:


Hi again,

I have a variety of utility functions I wrote in AS3 that I use all the time. I'm wondering if its possible to do this with haXe?

Here's an example:




package com.eclecticdesignstudio.utils {



public function ExampleFunction (output:String):void {

trace (output);

}


}




First off, it seems like haXe isn't cool with importing something that starts with a lower-case letter. Secondly, I'm not sure how I would replicate this structure (or if its possible?)



Thanks!

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




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


--
Joshua Granick
Owner / Lead Developer
[ eclecticdesignstudio ]
P: (916) 889-7306


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



--
Băluță Cristian
http://ralcr.com
http://imagin.ro

--
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: Is there any way to define utility functions in haXe? (similar to flash.net.navigateToURL, etc)

interaction-designer
In reply to this post by Antoine Gersant
Hi Marc (&list)

>>I have it on my todo list to implement anyway - but I'd like to give you
>>a choice :) Whether its added to the main distribution later is another
>>issue..

I voted -1 for shorthanded functions. Nicholas said he didn't like the unreadability about it (reason I voted it down also) and would not implement. What you're doing in your code is ofcourse up to you. You could also fork haxe ;) I don't share your endless exotic lambda passion and thus couldn't care less ...  Anyways, good luck with it and happy coding :)  




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