[PHP] externs and case sensitiveness

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

[PHP] externs and case sensitiveness

Julien CASTETS
Hi List,

For the first time I managed to write externs in PHP (for a private, not mine,  API), and that's a powerful feature :)

In the API I map, the PHP classes are all defined using lower case like this:

class foo_bar
{
    private $fooBar;
}

So my extern class will be:

extern class Foo_bar
{
        private var fooBar:Dynamic;

     static function __init__():Void untyped 
{
__call__("require_once", "/foo_bar.php");
}

        public function new():Void;
}

All this stuff works great under windows but:

haXe ask to start class definitions with an uppercase character, so I wonder if this will work under a case sensitive file system server like linux that I'll be using for production ?

If not what's a solution ?

For sure I can manage to modify the PHP code to follow this convention, but what if the PHP API is huge with tons of code and files ? (that's not the case ATM, just to know)

Cheers
Julien

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

Re: [PHP] externs and case sensitiveness

Franco Ponticelli
I strongly suggest you to use the native metadata like in:

@:native("foo_bar") extern class MyBarClass 

This gives you maximum flexibility in class naming and also you can use packages (and sub-packages) without the feat of breaking anything.

Franco

On Tue, Oct 12, 2010 at 4:57 PM, Julien CASTETS <[hidden email]> wrote:
Hi List,

For the first time I managed to write externs in PHP (for a private, not mine,  API), and that's a powerful feature :)

In the API I map, the PHP classes are all defined using lower case like this:

class foo_bar
{
    private $fooBar;
}

So my extern class will be:

extern class Foo_bar
{
        private var fooBar:Dynamic;

     static function __init__():Void untyped 
{
__call__("require_once", "/foo_bar.php");
}

        public function new():Void;
}

All this stuff works great under windows but:

haXe ask to start class definitions with an uppercase character, so I wonder if this will work under a case sensitive file system server like linux that I'll be using for production ?

If not what's a solution ?

For sure I can manage to modify the PHP code to follow this convention, but what if the PHP API is huge with tons of code and files ? (that's not the case ATM, just to know)

Cheers
Julien

--
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: [PHP] externs and case sensitiveness

Julien CASTETS
Hi Franco,

Thank you, I'll certainly do that :)

Cheers
Julien

2010/10/12 Franco Ponticelli <[hidden email]>
I strongly suggest you to use the native metadata like in:

@:native("foo_bar") extern class MyBarClass 

This gives you maximum flexibility in class naming and also you can use packages (and sub-packages) without the feat of breaking anything.

Franco

On Tue, Oct 12, 2010 at 4:57 PM, Julien CASTETS <[hidden email]> wrote:
Hi List,

For the first time I managed to write externs in PHP (for a private, not mine,  API), and that's a powerful feature :)

In the API I map, the PHP classes are all defined using lower case like this:

class foo_bar
{
    private $fooBar;
}

So my extern class will be:

extern class Foo_bar
{
        private var fooBar:Dynamic;

     static function __init__():Void untyped 
{
__call__("require_once", "/foo_bar.php");
}

        public function new():Void;
}

All this stuff works great under windows but:

haXe ask to start class definitions with an uppercase character, so I wonder if this will work under a case sensitive file system server like linux that I'll be using for production ?

If not what's a solution ?

For sure I can manage to modify the PHP code to follow this convention, but what if the PHP API is huge with tons of code and files ? (that's not the case ATM, just to know)

Cheers
Julien

--
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: [PHP] externs and case sensitiveness

clemos
In reply to this post by Julien CASTETS
Hi Julien

PHP is not case sensitive, so "class foo_bar" and "class Foo_bar" are
the same, with or without haXe, fortunately.
The only thing that may be a problem when switching from Windows to
Linux is the filename in your "require_once": If the file's actual
name is Foo_bar.php, linux won't find it if you
"require_once('foo_bar.php')".
Basically, on linux, the filesystem is case sensitive, but any
language *should* behave the same regarding case, wether on Linux or
on Windows.
(Yet, just in case, on linux, MySQL table names are case sensitive,
not in Windows... because of the filesystem)

Finally, I'd find it quite surprising to have anything running better
in Windows than in Linux, but that's just my opinion ;)

Cheers
+++++++
Clément

On Tue, Oct 12, 2010 at 5:57 PM, Julien CASTETS <[hidden email]> wrote:

> Hi List,
> For the first time I managed to write externs in PHP (for a private, not
> mine,  API), and that's a powerful feature :)
> In the API I map, the PHP classes are all defined using lower case like
> this:
> class foo_bar
> {
>     private $fooBar;
> }
> So my extern class will be:
> extern class Foo_bar
> {
>         private var fooBar:Dynamic;
>      static function __init__():Void untyped
> {
> __call__("require_once", "/foo_bar.php");
> }
>         public function new():Void;
> }
> All this stuff works great under windows but:
> haXe ask to start class definitions with an uppercase character, so I wonder
> if this will work under a case sensitive file system server like linux that
> I'll be using for production ?
> If not what's a solution ?
> For sure I can manage to modify the PHP code to follow this convention, but
> what if the PHP API is huge with tons of code and files ? (that's not the
> case ATM, just to know)
> Cheers
> Julien
> --
> 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: [PHP] externs and case sensitiveness

Julien CASTETS
Hi Clément,

Thank you for your precisions. 

I never remember what is case sensitive and what is not because I'm often juggling with many languages/platforms/os... Headaches!
I just remember struggling with Zend and the Autoloader which automatically require the needed php file with the class name but can't remember what was case sensitive or not :) or with the ios emulator that could be case sensitive or not and the ios device that is. Headaches again :)

I would really like to have my workstation using the same os that the production server to avoid this kind of (useless/boring) problems :)

I'll try to remember these rules :)

>Finally, I'd find it quite surprising to have anything running better
>in Windows than in Linux, but that's just my opinion ;)

I think I can't disagree with that, even if I'm mostly a Windows user because of games :)

Thank you to all again

Cheers
Julien

PS: I was not aware about MySQL behavior :)

2010/10/12 clemos <[hidden email]>
Hi Julien

PHP is not case sensitive, so "class foo_bar" and "class Foo_bar" are
the same, with or without haXe, fortunately.
The only thing that may be a problem when switching from Windows to
Linux is the filename in your "require_once": If the file's actual
name is Foo_bar.php, linux won't find it if you
"require_once('foo_bar.php')".
Basically, on linux, the filesystem is case sensitive, but any
language *should* behave the same regarding case, wether on Linux or
on Windows.
(Yet, just in case, on linux, MySQL table names are case sensitive,
not in Windows... because of the filesystem)

Finally, I'd find it quite surprising to have anything running better
in Windows than in Linux, but that's just my opinion ;)

Cheers
+++++++
Clément

On Tue, Oct 12, 2010 at 5:57 PM, Julien CASTETS <[hidden email]> wrote:
> Hi List,
> For the first time I managed to write externs in PHP (for a private, not
> mine,  API), and that's a powerful feature :)
> In the API I map, the PHP classes are all defined using lower case like
> this:
> class foo_bar
> {
>     private $fooBar;
> }
> So my extern class will be:
> extern class Foo_bar
> {
>         private var fooBar:Dynamic;
>      static function __init__():Void untyped
> {
> __call__("require_once", "/foo_bar.php");
> }
>         public function new():Void;
> }
> All this stuff works great under windows but:
> haXe ask to start class definitions with an uppercase character, so I wonder
> if this will work under a case sensitive file system server like linux that
> I'll be using for production ?
> If not what's a solution ?
> For sure I can manage to modify the PHP code to follow this convention, but
> what if the PHP API is huge with tons of code and files ? (that's not the
> case ATM, just to know)
> Cheers
> Julien
> --
> 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