[haXe] js

Axel Huizinga axel at 3drachen.de
Sat Dec 1 13:33:44 CET 2007


Franco Ponticelli schrieb:

> I have to correct myself; the compiler should not complain about the 
> use of Null inside a function body since that is a perfectly valid and 
> desirable.

The compiler doesn't complain but mozilla said: Null is not defined.
And stopped the script at this point.

Axel

>
> Franco.
>
> On Nov 30, 2007 10:22 PM, Axel Huizinga < axel at 3drachen.de 
> <mailto:axel at 3drachen.de>> wrote:
>
>     Franco Ponticelli schrieb:
>
>     > "Null" (with starting uppercase) is a reserved word for nullable
>     types
>     > (maybe the compiler should complain about using it in the wrong
>     > place). The keyword you need is "null" (lowercase).
>     > Enum constructors (horizontal, vertical, arc) start by
>     convention with
>     > an uppercase letter ... it is not mandatory but good practice :-)
>     >
>     > On Nov 30, 2007 9:13 PM, Axel Huizinga < axel at 3drachen.de
>     <mailto:axel at 3drachen.de>
>     > <mailto:axel at 3drachen.de <mailto:axel at 3drachen.de>>> wrote:
>     >
>     >     Hi Franco,
>     >
>     >     > Can you send the code that has generated the error?
>     >     > Anyway you don't need to import StdTypes because they are
>     always
>     >     > imported by default.
>     >
>     >     MenuBar.hx :
>     >
>     >     enum MAlign{
>     >        TL;
>     >        TC;
>     >        TR;
>     >        BL;
>     >        BC;
>     >        BR;
>     >        LT;
>     >        LC;
>     >        LB;
>     >        RT;
>     >        RC;
>     >        RB;
>     >        F;
>     >     }
>     >     enum MOrient{
>     >        horizontal;
>     >        vertical;
>     >        arc;
>     >     }
>     >
>     >     typedef MenuStyle = {
>     >        orient:MOrient,
>     >        align:MAlign
>     >     }
>     >
>     >     class MenuBar{
>     >        public var style:MenuStyle ;
>     >        public function new(?style:MenuStyle){
>     >            this.style = if(style!=Null)style else
>     {orient:horizontal,
>     >     align:BC};
>     >            trace(this);
>     >        }
>     >     }
>     >
>     >     instanciated from:
>     >     import MenuBar;
>     >
>     >     class DynaMenuBar{
>     >        public static function main(){
>     >            new MenuBar({orient:horizontal, align:BC});
>     >        }
>     >     }
>     >
>     >
>     >     ----
>     >
>     >     Axel
>     >
>     >
>     >     --
>     >     haXe - an open source web programming language
>     >     http://haxe.org
>     >
>     >
>     I love haxe :-)
>
>     --
>     haXe - an open source web programming language
>     http://haxe.org
>
>




More information about the Haxe mailing list