Why strings in method are not compared? I always get false result.

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

Why strings in method are not compared? I always get false result.

Artyom Silivonchik
Hi,
This message is a copy of forum topic http://haxe.org/forum/thread/3125
---

Why strings in method are not compared? I always get false result.

I have a method:



dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int
{
    trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
    return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));
}

Than I try to call it:



// Case 1
trace("test1" + " > " + "test2" + " = " + ("test1" > "test1")); 
// Case 2
trace("test3" + " > " + "test2" + " = " + ("test3" > "test1"));
// Case 3
sigSort(["test1",3],["test2",6]);
// Case 4
sigSort(["test3",3],["test2",6]);

Expected result


- Case 1: test1 > test2 = false
- Case 2: test3 > test2 = true
- Case 3: test1 > test2 = false
- Case 4: test3 > test2 = true

Actual result


- Case 1: test1 > test2 = false
- Case 2: test3 > test2 = true
- Case 3: test1 > test2 = false
- Case 4: test3 > test2 = false
---
Why does this happen? Why case 4 is different from case 2?

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

Re: Why strings in method are not compared? I always get false result.

Tony Polinelli
what if you try:


dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int
{
    trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
    return (if (a[0] == b[0]) 0 else (if (cast(a[0], String) > cast(b[0], String)) 1 else -1));
}
i dont think that a "stinrg" > "stinrg" is a check that is supposed to work (correct me if im wrong) but how is the physical comparison supposed to work? 

how is a string "greater" than another one? The number of byes that it takes to store? the length? the sum of the charcodes? 

sure your not intending to check the INT values?

it is also expected that Dynamic may function differently in edge cases (like this one) - so casting to String might get you the same functionality. 

cheers


On Wed, Jul 6, 2011 at 5:12 PM, Артемий Силивончик <[hidden email]> wrote:
Hi,
This message is a copy of forum topic http://haxe.org/forum/thread/3125
---

Why strings in method are not compared? I always get false result.

I have a method:



dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int
{
    trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
    return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));
}

Than I try to call it:



// Case 1
trace("test1" + " > " + "test2" + " = " + ("test1" > "test1")); 
// Case 2
trace("test3" + " > " + "test2" + " = " + ("test3" > "test1"));
// Case 3
sigSort(["test1",3],["test2",6]);
// Case 4
sigSort(["test3",3],["test2",6]);

Expected result


- Case 1: test1 > test2 = false
- Case 2: test3 > test2 = true
- Case 3: test1 > test2 = false
- Case 4: test3 > test2 = true

Actual result


- Case 1: test1 > test2 = false
- Case 2: test3 > test2 = true
- Case 3: test1 > test2 = false
- Case 4: test3 > test2 = false
---
Why does this happen? Why case 4 is different from case 2?

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



--
Tony Polinelli
http://touchmypixel.com

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

Re: Why strings in method are not compared? I always get false result.

Artyom Silivonchik
In reply to this post by Artyom Silivonchik
Bad markdown/formatting, sorry for that.
See better variant below, please.

Hi,
This message is a copy of forum topic http://haxe.org/forum/thread/3125
---

Why strings in method are not compared? I always get *false* result.

I have a method:
dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int
{
   trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
   return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));
}

Than I try to call it:
// Case 1
trace("test1" + " > " + "test2" + " = " + ("test1" > "test1"));
// Case 2
trace("test3" + " > " + "test2" + " = " + ("test3" > "test1"));
// Case 3
sigSort(["test1",3],["test2",6]);
// Case 4
sigSort(["test3",3],["test2",6]);

Expected result
- Case 1: test1 > test2 = false
- Case 2: test3 > test2 = true
- Case 3: test1 > test2 = false
- Case 4: test3 > test2 = true 
Actual result
- Case 1: test1 > test2 = false
- Case 2: test3 > test2 = true
- Case 3: test1 > test2 = false
- Case 4: *test3 > test2 = false*
---
Why does this happen? Why case 4 is different from case 2?


Best Regards,
Artyom S.

On Wed, Jul 6, 2011 at 10:13 AM, <[hidden email]> wrote:
Send Haxe mailing list submissions to
       [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.motion-twin.com/mailman/listinfo/haxe
or, via email, send a message with subject or body 'help' to
       [hidden email]

You can reach the person managing the list at
       [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Haxe digest..."


Today's Topics:

  1. Why strings in method are not compared? I always get false
     result. (??????? ??????????)


----------------------------------------------------------------------

Message: 1
Date: Wed, 6 Jul 2011 10:12:06 +0300
From: ??????? ??????????        <[hidden email]>
Subject: [haXe] Why strings in method are not compared? I always get
       false   result.
To: [hidden email]
Message-ID:
       <CACsidfg3_o=[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Hi,
This message is a copy of forum topic http://haxe.org/forum/thread/3125
---

Why strings in method are not compared? I always get *false* result.
 I have a method:

dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int{
   trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
   return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));}

Than I try to call it:

// Case 1
trace("test1" + " > " + "test2" + " = " + ("test1" > "test1")); // Case 2
trace("test3" + " > " + "test2" + " = " + ("test3" > "test1"));// Case 3
sigSort(["test1",3],["test2",6]);// Case 4
sigSort(["test3",3],["test2",6]);

Expected result
- Case 1: test1 > test2 = false
- Case 2: test3 > test2 = true
- Case 3: test1 > test2 = false
- Case 4: test3 > test2 = true Actual result
- Case 1: test1 > test2 = false
- Case 2: test3 > test2 = true
- Case 3: test1 > test2 = false
- Case 4: *test3 > test2 = false*
---
Why does this happen? Why case 4 is different from case 2?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20110706/5c8caecd/attachment.htm

------------------------------

_______________________________________________
Haxe mailing list
[hidden email]
http://lists.motion-twin.com/mailman/listinfo/haxe


End of Haxe Digest, Vol 69, Issue 23
************************************


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

Re: Why strings in method are not compared? I always get false result.

Artyom Silivonchik
In reply to this post by Artyom Silivonchik
Hi Tony,

Type.typeof(a[0]) is showing that it is a String, so I don't think the cast is needed here.

Yesterday I tried a[0].toString() too, but still I get false result in method. 
I will try your casting variant today in the evening and comment on this, thanks.

About comparison of strings - strings are compared byte by byte from the beginning to end, if one of the bytes is greater that other - that string is treated greater. This is a default comparison for string for different languages - haXe, Ruby, Python, Pascal, ...

And this comparison is working correctly in haxe outside of method.

I need to compare exactly string values, int values are just some dynamic values tied with strings.

Best Regards,
Artyom S.


On Wed, Jul 6, 2011 at 10:32 AM, <[hidden email]> wrote:
Send Haxe mailing list submissions to
       [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.motion-twin.com/mailman/listinfo/haxe
or, via email, send a message with subject or body 'help' to
       [hidden email]

You can reach the person managing the list at
       [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Haxe digest..."


Today's Topics:

  1. Re: Why strings in method are not compared? I always get
     false     result. (Tony Polinelli)


----------------------------------------------------------------------

Message: 1
Date: Wed, 6 Jul 2011 17:31:49 +1000
From: Tony Polinelli <[hidden email]>
Subject: Re: [haXe] Why strings in method are not compared? I always
       get false       result.
To: The haXe compiler list <[hidden email]>
Message-ID:
       <[hidden email]>
Content-Type: text/plain; charset="utf-8"

what if you try:

dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int{
   trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
   return (if (a[0] == b[0]) 0 else (if (cast(a[0], String) >
cast(b[0], String)) 1 else -1));}

i dont think that a "stinrg" > "stinrg" is a check that is supposed to work
(correct me if im wrong) but how is the physical comparison supposed to
work?

how is a string "greater" than another one? The number of byes that it takes
to store? the length? the sum of the charcodes?

sure your not intending to check the INT values?

it is also expected that Dynamic may function differently in edge cases
(like this one) - so casting to String might get you the same
functionality.

cheers


On Wed, Jul 6, 2011 at 5:12 PM, Артемий Силивончик <[hidden email]>wrote:

> Hi,
> This message is a copy of forum topic http://haxe.org/forum/thread/3125
> ---
>
> Why strings in method are not compared? I always get *false* result.
>  I have a method:
>
> dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int{
>     trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
>     return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));}
>
> Than I try to call it:
>
> // Case 1
> trace("test1" + " > " + "test2" + " = " + ("test1" > "test1")); // Case 2
> trace("test3" + " > " + "test2" + " = " + ("test3" > "test1"));// Case 3
> sigSort(["test1",3],["test2",6]);// Case 4
> sigSort(["test3",3],["test2",6]);
>
> Expected result
> - Case 1: test1 > test2 = false
> - Case 2: test3 > test2 = true
> - Case 3: test1 > test2 = false
> - Case 4: test3 > test2 = true Actual result
> - Case 1: test1 > test2 = false
> - Case 2: test3 > test2 = true
> - Case 3: test1 > test2 = false
> - Case 4: *test3 > test2 = false*
> ---
> Why does this happen? Why case 4 is different from case 2?
>
> --
> haXe - an open source web programming language
> http://haxe.org
>



--
Tony Polinelli
http://touchmypixel.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20110706/bde86513/attachment.htm

------------------------------

_______________________________________________
Haxe mailing list
[hidden email]
http://lists.motion-twin.com/mailman/listinfo/haxe


End of Haxe Digest, Vol 69, Issue 24
************************************


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

Re: Why strings in method are not compared? I always get false result.

Heinz Hölzer-2
In reply to this post by Artyom Silivonchik
You have to do a cast like this:

dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int
    {
        var first = cast(a[0], String);
        var sec = cast(b[0], String);
       
       trace(first+" > "+sec+" = "+(first > sec)); // deb#ug output
        return (if (first == sec) 0 else (if (first > sec) 1 else -1));
      
    }

You should avoid using Dynamic when possible. The way the comparision between dynamic types is done cannot be guaranteed by haxe because it's left to the runtime.


Am 06.07.2011 09:12, schrieb Артемий Силивончик:
Hi,
This message is a copy of forum topic http://haxe.org/forum/thread/3125
---

Why strings in method are not compared? I always get false result.

I have a method:


dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int
{
    trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
    return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));
}

Than I try to call it:


// Case 1
trace("test1" + " > " + "test2" + " = " + ("test1" > "test1")); 
// Case 2
trace("test3" + " > " + "test2" + " = " + ("test3" > "test1"));
// Case 3
sigSort(["test1",3],["test2",6]);
// Case 4
sigSort(["test3",3],["test2",6]);

Expected result


- Case 1: test1 > test2 = false
- Case 2: test3 > test2 = true
- Case 3: test1 > test2 = false
- Case 4: test3 > test2 = true

Actual result


- Case 1: test1 > test2 = false
- Case 2: test3 > test2 = true
- Case 3: test1 > test2 = false
- Case 4: test3 > test2 = false
---
Why does this happen? Why case 4 is different from case 2?


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

Re: Why strings in method are not compared? I always get false result.

Jan_Flanders
In reply to this post by Artyom Silivonchik
>From the moment when one of those two arrays contains a non String element the compiler will cast all elements to Number if you compare them, otherwise it will cast all to String.
The same code compiled with mxmlc (assuming Flash as your target) does not cast at all. I checked both the bytecode.

Jan


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

Re: Why strings in method are not compared? I always get false result.

alexander.konotop
In reply to this post by Artyom Silivonchik
В Wed, 6 Jul 2011 10:33:51 +0300
Artyom Silivonchik <[hidden email]> пишет:

> Bad markdown/formatting, sorry for that.
> See better variant below, please.
>
> Hi,
> This message is a copy of forum topic
> http://haxe.org/forum/thread/3125 ---
>
> Why strings in method are not compared? I always get *false* result.
> *
> *
> *I have a method:*
> dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int
> {
>    trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
>    return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));
> }
>
> *Than I try to call it:*
> // Case 1
> trace("test1" + " > " + "test2" + " = " + ("test1" > "test1"));
> // Case 2
> trace("test3" + " > " + "test2" + " = " + ("test3" > "test1"));
> // Case 3
> sigSort(["test1",3],["test2",6]);
> // Case 4
> sigSort(["test3",3],["test2",6]);
>
> *Expected result*
> - Case 1: test1 > test2 = false
> - Case 2: test3 > test2 = true
> - Case 3: test1 > test2 = false
> - Case 4: test3 > test2 = true
> *Actual result*
> - Case 1: test1 > test2 = false
> - Case 2: test3 > test2 = true
> - Case 3: test1 > test2 = false
> - Case 4: *test3 > test2 = false*
> ---
> *Why does this happen? Why case 4 is different from case 2?*
>
> Best Regards,
> Artyom S.
>
> On Wed, Jul 6, 2011 at 10:13 AM, <[hidden email]>
> wrote:
>
> > Send Haxe mailing list submissions to
> >        [hidden email]
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >        http://lists.motion-twin.com/mailman/listinfo/haxe
> > or, via email, send a message with subject or body 'help' to
> >        [hidden email]
> >
> > You can reach the person managing the list at
> >        [hidden email]
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of Haxe digest..."
> >
> >
> > Today's Topics:
> >
> >   1. Why strings in method are not compared? I always get false
> >      result. (??????? ??????????)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Wed, 6 Jul 2011 10:12:06 +0300
> > From: ??????? ??????????        <[hidden email]>
> > Subject: [haXe] Why strings in method are not compared? I always get
> >        false   result.
> > To: [hidden email]
> > Message-ID:
> >        <CACsidfg3_o=[hidden email]
> > >
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Hi,
> > This message is a copy of forum topic
> > http://haxe.org/forum/thread/3125 ---
> >
> > Why strings in method are not compared? I always get *false* result.
> >  I have a method:
> >
> > dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int{
> >    trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
> >    return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));}
> >
> > Than I try to call it:
> >
> > // Case 1
> > trace("test1" + " > " + "test2" + " = " + ("test1" > "test1")); //
> > Case 2 trace("test3" + " > " + "test2" + " = " + ("test3" >
> > "test1"));// Case 3 sigSort(["test1",3],["test2",6]);// Case 4
> > sigSort(["test3",3],["test2",6]);
> >
> > Expected result
> > - Case 1: test1 > test2 = false
> > - Case 2: test3 > test2 = true
> > - Case 3: test1 > test2 = false
> > - Case 4: test3 > test2 = true Actual result
> > - Case 1: test1 > test2 = false
> > - Case 2: test3 > test2 = true
> > - Case 3: test1 > test2 = false
> > - Case 4: *test3 > test2 = false*
> > ---
> > Why does this happen? Why case 4 is different from case 2?
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL:
> > http://lists.motion-twin.com/pipermail/haxe/attachments/20110706/5c8caecd/attachment.htm
> >
> > ------------------------------
> >
> > _______________________________________________
> > Haxe mailing list
> > [hidden email]
> > http://lists.motion-twin.com/mailman/listinfo/haxe
> >
> >
> > End of Haxe Digest, Vol 69, Issue 23
> > ************************************
> >

Actually... I have the right result while compiling to neko.
//Main.hx-----------------------------------------------------
class Main
{
  public static function main()
  {
    // Case 1
    trace("test1" + " > " + "test2" + " = " + ("test1" > "test1"));
    // Case 2
    trace("test3" + " > " + "test2" + " = " + ("test3" > "test1"));
    // Case 3
    sigSort(["test1",3],["test2",6]);
    // Case 4
    sigSort(["test3",3],["test2",6]);
  }
  static function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int
  {
    trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
    return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));
  }
}
//main.hxml---------------------------------------------------
-main Main
-neko main.n

The result is:
Main.hx:6: test1 > test2 = false
Main.hx:8: test3 > test2 = true
Main.hx:16: test1 > test2 = false
Main.hx:16: test3 > test2 = true

But as You can see there's one difference: my function is static. Can
it matter?..

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

Re: Why strings in method are not compared? I always get false result.

Artyom Silivonchik
In reply to this post by Artyom Silivonchik
Thanks everyone for answers.

Following solution with cast to string work correctly:
cast(a[0], String);

As we can see in comments above code is working correctly with Neko target, so it is probably a Flash target problem.

My problem is solved now, I'll add the correct code to forum at haxe.org

Best Regards,
Artyom S.

On Wed, Jul 6, 2011 at 8:11 PM, <[hidden email]> wrote:
Send Haxe mailing list submissions to
       [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.motion-twin.com/mailman/listinfo/haxe
or, via email, send a message with subject or body 'help' to
       [hidden email]

You can reach the person managing the list at
       [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Haxe digest..."


Today's Topics:

  1. Re: Why strings in method are not compared? I always get
     false     result. (Jan Flanders)
  2. Re: non-admin installation of haxe for osx (Davide Della Casa)
  3. Re: non-admin installation of haxe for osx (Andy Li)
  4. Re: Revisit licencing question for libs (Andy Li)
  5. Re: non-admin installation of haxe for osx (Davide Della Casa)
  6. Re: Re: Why strings in method are not compared? I always get
     false result. (Alexander Konotop)


----------------------------------------------------------------------

Message: 1
Date: Wed, 6 Jul 2011 13:17:21 +0200
From: Jan Flanders <[hidden email]>
Subject: Re: [haXe] Why strings in method are not compared? I always
       get false       result.
To: The haXe compiler list <[hidden email]>
Message-ID:
       <CAMeYB=[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

>From the moment when one of those two arrays contains a non String element
the compiler will cast all elements to Number if you compare them, otherwise
it will cast all to String.
The same code compiled with mxmlc (assuming Flash as your target) does not
cast at all. I checked both the bytecode.

Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20110706/6c7f77c8/attachment-0001.htm

------------------------------

Message: 2
Date: Wed, 6 Jul 2011 14:33:57 +0200
From: Davide Della Casa <[hidden email]>
Subject: Re: [haXe] non-admin installation of haxe for osx
To: The haXe compiler list <[hidden email]>
Message-ID:
       <[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Made version 2.

It's cleaned up now and it also runs hxcpp (i.e. it generates the .cpp files
for the test). Note that in raw OSX there is no XCode/gcc installed, so the
build part of hxcpp fails.

I'm reading whether it's possible to get gcc+headers without installing
xcode - looks tough but that would be cool. Any advice welcome.

Cheers,
D

#########################
cd ~/Downloads
curl http://nekovm.org/_media/neko-1.8.1-osx.tar.gz > neko.tgz
curl http://haxe.org/file/haxe-2.07-osx.tar.gz > haxe.tgz
tar -zxvf neko.tgz
tar -zxvf haxe.tgz
rm haxe.tgz neko.tgz
export HAXEPATH=$HOME/Downloads/haxe-2.07-osx/
export NEKOPATH=$HOME/Downloads/neko-1.8.1-osx/
export PATH=$HAXEPATH:$NEKOPATH:$PATH
export DYLD_LIBRARY_PATH=$HOME/Downloads/neko-1.8.1-osx/
haxelib setup $HOME/Downloads/
haxelib install hxcpp
haxelib install nme
export HXCPP=$HOME/Downloads/hxcpp/
export HAXE_LIBRARY_PATH=$HOME/Downloads/haxe-2.07-osx/std/
export LD_LIBRARY_PATH=$HOME/Downloads/hxcpp/2,07,0/bin/Mac/
export LD_LIBRARY_PATH=$HOME/Downloads/nme/2,0,1/ndll/Mac/:$LD_LIBRARY_PATH
## and now some testing
cd nme/2,0,1/samples/02-Text
haxe compile.hxml
neko Sample.n
haxe -main Sample -cpp bin -lib nme
######################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20110706/b97301ee/attachment-0001.htm

------------------------------

Message: 3
Date: Wed, 6 Jul 2011 21:46:40 +0800
From: Andy Li <[hidden email]>
Subject: Re: [haXe] non-admin installation of haxe for osx
To: The haXe compiler list <[hidden email]>
Message-ID:
       <CAM-5HMuDB=[hidden email]>
Content-Type: text/plain; charset="utf-8"

Interesting, maybe you can paste that to gist.github.com or the haxe wiki
for ppl to keep track.

cheers,
Andy

On Wed, Jul 6, 2011 at 8:33 PM, Davide Della Casa <[hidden email]>wrote:

> Made version 2.
>
> It's cleaned up now and it also runs hxcpp (i.e. it generates the .cpp
> files for the test). Note that in raw OSX there is no XCode/gcc installed,
> so the build part of hxcpp fails.
>
> I'm reading whether it's possible to get gcc+headers without installing
> xcode - looks tough but that would be cool. Any advice welcome.
>
> Cheers,
> D
>
> #########################
> cd ~/Downloads
> curl http://nekovm.org/_media/neko-1.8.1-osx.tar.gz > neko.tgz
> curl http://haxe.org/file/haxe-2.07-osx.tar.gz > haxe.tgz
> tar -zxvf neko.tgz
> tar -zxvf haxe.tgz
> rm haxe.tgz neko.tgz
> export HAXEPATH=$HOME/Downloads/haxe-2.07-osx/
> export NEKOPATH=$HOME/Downloads/neko-1.8.1-osx/
> export PATH=$HAXEPATH:$NEKOPATH:$PATH
> export DYLD_LIBRARY_PATH=$HOME/Downloads/neko-1.8.1-osx/
> haxelib setup $HOME/Downloads/
> haxelib install hxcpp
> haxelib install nme
> export HXCPP=$HOME/Downloads/hxcpp/
>  export HAXE_LIBRARY_PATH=$HOME/Downloads/haxe-2.07-osx/std/
> export LD_LIBRARY_PATH=$HOME/Downloads/hxcpp/2,07,0/bin/Mac/
> export LD_LIBRARY_PATH=$HOME/Downloads/nme/2,0,1/ndll/Mac/:$LD_LIBRARY_PATH
> ## and now some testing
> cd nme/2,0,1/samples/02-Text
> haxe compile.hxml
> neko Sample.n
> haxe -main Sample -cpp bin -lib nme
> ######################
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20110706/ad3dec9b/attachment-0001.htm

------------------------------

Message: 4
Date: Wed, 6 Jul 2011 21:50:13 +0800
From: Andy Li <[hidden email]>
Subject: Re: [haXe] Revisit licencing question for libs
To: The haXe compiler list <[hidden email]>
Message-ID:
       <CAM-5HMvb5dGnre3RRCp=[hidden email]>
Content-Type: text/plain; charset="utf-8"

The license question/issue came up and gone a few times, maybe it is good to
put it into haxe 3's TODO?

Best,
Andy

On Tue, Jul 5, 2011 at 1:36 PM, Greg Dove <[hidden email]> wrote:

> I have a question that has been in the back of my mind for a while....about
> haxe licencing, I tried searching the list archives and forums but couldn't
> find any updates on the information on the site.
>
> "During the first haXe community meeting, it was decided that the libraries
> will eventually be re-licensed under a different license"
> http://haxe.org/com/meeting
>
> I will be doing an "Introduction to Haxe" presentation to a group of
> actionscripters in a few months time, and thought I better start to
> understand this part some more.
>
> I am interested to know whether the current requirement for redistribution
> in binary form is still planned to be reviewed:
> "Redistributions in binary form must reproduce the above copyright
>  *     notice, this list of conditions and the following disclaimer in the
>  *     documentation and/or other materials provided with the distribution"
>
>
> At the meeting transcript linked to above there appeared to be a
> "consensus" to move more towards an MIT style licence.
>
> I don't personally have an issue if this will continue to be a requirement
> as it is although I do also prefer MIT myself, because it has source-code
> only requirements, and its the licence I am familiar with for projects I
> have contributed to thus far. I think that by not changing, it is possible
> that this might hold back wider adoption of haxe or acceptance of haxe for
> some projects (by clients) even when the developer is trying to advocate it.
> Which - if true - would be disappointing for Haxe. I can't say if this is a
> valid concern as I have not as yet used Haxe in any commercial projects -
> it's just my speculation.
>
> In terms of interpreting the current terms it is also unclear how the
> licence should be accessed when the licence must accompany a "binary form".
> Does it mean that that binary form should be accompanied by the licence in a
> separate text file or that the licence terms must be accessible during its
> use (by a typical user - e.g. in an application 'about' dialog or similar).
>
> Also it is unclear what the std library (or haxelib) source code actually
> is for some targets... in relation to :
> "Redistributions of source code must retain the above copyright  notice"
>
> Is it the original haxe code alone ( Type.hx files etc- that does seem
> clear) or does it include generated source (Type.class.php etc e.g. for php,
> cpp, js - and sounds like java and c# in the future!).
> In this case is the generated source code the "binary form"? (not
> intuitive)
>
> If "the source code" in the licence is also the generated source then for
> js in particular it may not make much sense to a lot of people if they want
> compact js downloads.
> And if it is inclusive of the generated source code, then there should be
> the option to add the copyright to the generated source during compile (or
> have I missed that perhaps?) to make it easy for people to adhere to the
> terms.
>
> I know haxe is used in some commercial projects , so presumably some people
> have satisfied themselves with how to answer these questions.
>
> So I guess its more than a simple question... if the requirement will
> remain as it is then I think it needs clarification, and possibly make it
> easier for people to comply without too much effort if there are ways to do
> that.
> If it will change, then it may still need some clarifications.
>
> Any thoughts?  (Apart from: "I wish this post was shorter!")
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20110706/3370cadd/attachment-0001.htm

------------------------------

Message: 5
Date: Wed, 6 Jul 2011 17:30:13 +0200
From: Davide Della Casa <[hidden email]>
Subject: Re: [haXe] non-admin installation of haxe for osx
To: The haXe compiler list <[hidden email]>
Message-ID:
       <CALNNn2NwUZTp2aW5vCfF+M6WXp=[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Fair enough. I've put it here:
http://haxe.org/doc/osxinstallnoadmin

Cheers,
Davide

On Wed, Jul 6, 2011 at 3:46 PM, Andy Li <[hidden email]> wrote:

> Interesting, maybe you can paste that to gist.github.com or the haxe wiki
> for ppl to keep track.
>
> cheers,
> Andy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20110706/c6a82a5a/attachment-0001.htm

------------------------------

Message: 6
Date: Wed, 6 Jul 2011 20:10:39 +0300
From: Alexander Konotop <[hidden email]>
Subject: Re: [haXe] Re: Why strings in method are not compared? I
       always get      false result.
To: [hidden email]
Message-ID: <20110706201039.5e8a98d9@jager>
Content-Type: text/plain; charset=KOI8-U

В Wed, 6 Jul 2011 10:33:51 +0300
Artyom Silivonchik <[hidden email]> пишет:

> Bad markdown/formatting, sorry for that.
> See better variant below, please.
>
> Hi,
> This message is a copy of forum topic
> http://haxe.org/forum/thread/3125 ---
>
> Why strings in method are not compared? I always get *false* result.
> *
> *
> *I have a method:*
> dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int
> {
>    trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
>    return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));
> }
>
> *Than I try to call it:*
> // Case 1
> trace("test1" + " > " + "test2" + " = " + ("test1" > "test1"));
> // Case 2
> trace("test3" + " > " + "test2" + " = " + ("test3" > "test1"));
> // Case 3
> sigSort(["test1",3],["test2",6]);
> // Case 4
> sigSort(["test3",3],["test2",6]);
>
> *Expected result*
> - Case 1: test1 > test2 = false
> - Case 2: test3 > test2 = true
> - Case 3: test1 > test2 = false
> - Case 4: test3 > test2 = true
> *Actual result*
> - Case 1: test1 > test2 = false
> - Case 2: test3 > test2 = true
> - Case 3: test1 > test2 = false
> - Case 4: *test3 > test2 = false*
> ---
> *Why does this happen? Why case 4 is different from case 2?*
>
> Best Regards,
> Artyom S.
>
> On Wed, Jul 6, 2011 at 10:13 AM, <[hidden email]>
> wrote:
>
> > Send Haxe mailing list submissions to
> >        [hidden email]
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >        http://lists.motion-twin.com/mailman/listinfo/haxe
> > or, via email, send a message with subject or body 'help' to
> >        [hidden email]
> >
> > You can reach the person managing the list at
> >        [hidden email]
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of Haxe digest..."
> >
> >
> > Today's Topics:
> >
> >   1. Why strings in method are not compared? I always get false
> >      result. (??????? ??????????)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Wed, 6 Jul 2011 10:12:06 +0300
> > From: ??????? ??????????        <[hidden email]>
> > Subject: [haXe] Why strings in method are not compared? I always get
> >        false   result.
> > To: [hidden email]
> > Message-ID:
> >        <CACsidfg3_o=[hidden email]
> > >
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Hi,
> > This message is a copy of forum topic
> > http://haxe.org/forum/thread/3125 ---
> >
> > Why strings in method are not compared? I always get *false* result.
> >  I have a method:
> >
> > dynamic function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int{
> >    trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
> >    return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));}
> >
> > Than I try to call it:
> >
> > // Case 1
> > trace("test1" + " > " + "test2" + " = " + ("test1" > "test1")); //
> > Case 2 trace("test3" + " > " + "test2" + " = " + ("test3" >
> > "test1"));// Case 3 sigSort(["test1",3],["test2",6]);// Case 4
> > sigSort(["test3",3],["test2",6]);
> >
> > Expected result
> > - Case 1: test1 > test2 = false
> > - Case 2: test3 > test2 = true
> > - Case 3: test1 > test2 = false
> > - Case 4: test3 > test2 = true Actual result
> > - Case 1: test1 > test2 = false
> > - Case 2: test3 > test2 = true
> > - Case 3: test1 > test2 = false
> > - Case 4: *test3 > test2 = false*
> > ---
> > Why does this happen? Why case 4 is different from case 2?
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL:
> > http://lists.motion-twin.com/pipermail/haxe/attachments/20110706/5c8caecd/attachment.htm
> >
> > ------------------------------
> >
> > _______________________________________________
> > Haxe mailing list
> > [hidden email]
> > http://lists.motion-twin.com/mailman/listinfo/haxe
> >
> >
> > End of Haxe Digest, Vol 69, Issue 23
> > ************************************
> >

Actually... I have the right result while compiling to neko.
//Main.hx-----------------------------------------------------
class Main
{
 public static function main()
 {
   // Case 1
   trace("test1" + " > " + "test2" + " = " + ("test1" > "test1"));
   // Case 2
   trace("test3" + " > " + "test2" + " = " + ("test3" > "test1"));
   // Case 3
   sigSort(["test1",3],["test2",6]);
   // Case 4
   sigSort(["test3",3],["test2",6]);
 }
 static function sigSort(a:Array<Dynamic>, b:Array<Dynamic>):Int
 {
   trace(a[0]+" > "+b[0]+" = "+(a[0]>b[0])); // debug output
   return (if (a[0] == b[0]) 0 else (if (a[0] > b[0]) 1 else -1));
 }
}
//main.hxml---------------------------------------------------
-main Main
-neko main.n

The result is:
Main.hx:6: test1 > test2 = false
Main.hx:8: test3 > test2 = true
Main.hx:16: test1 > test2 = false
Main.hx:16: test3 > test2 = true

But as You can see there's one difference: my function is static. Can
it matter?..



------------------------------

_______________________________________________
Haxe mailing list
[hidden email]
http://lists.motion-twin.com/mailman/listinfo/haxe


End of Haxe Digest, Vol 69, Issue 28
************************************


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