В Mon, 05 Mar 2012 19:20:02 +0100
Nicolas Cannasse <[email protected]> пишет:
> Le 05/03/2012 16:39, Alexander Konotop a écrit :
> > Hello :-)
> >
> > I'm building 64bit neko 1.8.2 *.deb package.
> > I've built it, helloworld (trace) works. Also I've built haxe 2.08.
> > But when I'm trying to compile more smth more complex than
> > helloworld - I get this message while trying to run compiled *.n:
> >
> > Uncaught exception - module.c(124) : Builtin not found : t
>
> Seems like you're having an "untyped $t" somewhere in your haXe code.
>
> $-prefixed variables are reserved for builtins in Neko, so you
> shouldn't use them for other purposes.
>
> Best,
> Nicolas
>
I've improved my HelloWorld - maked it to use threads and sending http
requests. It's compiling and and starting - so it seems like You are
right - my neko build works and I have some kind of variable name
conflict (btw specific for 1.8.2 and not for 1.8.1). But I have no "$"
symbols at all - I've searched in a code directory with midnight
commander - there are none of them. But it's OK - I hope I'll find
which variable has wrong name - maybe another symbol or name causes a
problem. Another thing is far more interesting: neko 1.8.1 fits for me
enough and I didn't use 1.8.2 before. Today I wanted just to test my
project in 1.8.2 to make sure that I've found a bug. Now I see that I've
unfortunately found it and 1.8.2 (+ haxe 2.08) behaviour doesn't differ
from 1.8.1 (+haxe 2.07). Please look at this simple example - maybe
I've just made a mistake in the code:
------------------------------------------------
//HelloWorld.hx
class HelloWorld
{
public static function main()
{
var post : String = "";
trace("hello!");
var htpr : haxe.Http = new
haxe.Http("http://google.com");
htpr.onData = function (data : String)
{
trace(data);
};
htpr.onError = function (message : String)
{
trace(message);
};
//htpr.setPostData(post);
htpr.request(true);
neko.vm.Thread.create(background);
neko.Sys.sleep(1);
}
static function background() : Void
{
trace ("I'm a background");
}
}
------------------------------------------------
------------------------------------------------
//helloworld.hxml:
-neko helloworld.n
-main HelloWorld
-debug
------------------------------------------------
The problem is in setPostData() - it hangs.
If I don't uncomment the string with htpr.setPostData() - the terminal
output will be:
==========================
HelloWorld.hx:6: hello! //no comments :-)
//Here goes ~0.5 second pause
//because we're waiting for a response from google.
HelloWorld.hx:14: Http Error #411 //this is normal. Seems like google
//uses lighttpd or nginx
HelloWorld.hx:23: I'm a background //also no comments - just we see
//that threads are working without
//any problems
==========================
But if I uncomment the string - the output will be:
==========================
HelloWorld.hx:6: hello!
//OMG... Here goes 10 seconds pause...
HelloWorld.hx:14: Blocked //OMG again...
HelloWorld.hx:23: I'm a background
==========================
The abovementioned pause is 10 seconds - it's the default cnxTimeout.
If we write trace(htpr) somewhere - we'll see that htpr.cnxTimeout=10;
So what is this - a bug or a mistake in the code?
Best regards
Alexander
--
Neko : One VM to run them all
(http://nekovm.org)