[haXe] Just a suggestion

Ralf Bokelberg ralf.bokelberg at gmail.com
Thu Dec 6 15:39:22 CET 2007


It could be made an optional warning
Cheers
Ralf.

On Dec 6, 2007 3:32 PM,  <lee at designrealm.co.uk> wrote:
> What are your thoughts on this Nicolas?  You built the darn thing, but
> you've only so far said you'd look at it ;-)
>
>
> Lee
>
>
>
>
>
>
>
> Quoting "Petersson, Tobias" <Tobias.Petersson at laerdal.dk>:
>
> > I also love the flexiblity of the language. Don't get me wrong.
> > But you keep getting away from the issue. ( Though there are some cool
> > examples ;) )
> >
> > The issue was to provide an opportunity to help you not to make a stupid
> > misstake.
> > Not to remove any flexiblity out of the haXe language.
> >
> > I won't make any further comments.
> > /T
> >
> > -----Original Message-----
> > From: haxe-bounces at lists.motion-twin.com
> > [mailto:haxe-bounces at lists.motion-twin.com] On Behalf Of
> > lee at designrealm.co.uk
> > Sent: den 6 december 2007 15:16
> > To: haxe at lists.motion-twin.com
> > Subject: RE: [haXe] Just a suggestion
> >
> > This is true. But look at what you typed. The block doesn't know it will
> > be assigned to a variable, it only knows to provide access to the last
> > value in its stack, so either way:
> >
> > t;
> >
> > is legal. Also, blocks are used all the time without being assigned to
> > anything. Granted, a block that expresses a value as above without being
> > assigned to anything is probably useless, but we don't know where that
> > will exist. Take this
> >
> > for( a in 0...10 )
> > {
> >    //somecode
> >    {
> >      //somecode
> >      while( b )
> >      {
> >        //somecode
> >        t;
> >      }
> >    }
> > }
> >
> > This is legal, and the value of the for loop could very well be the
> > value of t, but what does the value of for get used for? That's quite
> > some nesting, yet t remains on the stack at the end of the execution, so
> > that's the value you're left with. If the compiler can perform a check
> > through the stack to see if the value is ever assigned, then a warning
> > might be plausible, but there will be times when this is probably not
> > doable, due to the dynamics of the code, so you might be left with a
> > warning during execution, if you implement it yourself.
> >
> > Also, what different is:
> >
> > t;
> >
> > to...
> >
> > var add = function(a,b)
> > {
> >    return a+b;
> > }
> > add(5+5);
> >
> > the returned value isn't used, it's placed on the stack just as t is,
> > yet this would have to be legal as your function may be performing tasks
> > where the return value is not important. And, yes, I know you'll reply
> > that this is not the same ;-) But it raises more questions worth
> > considering.
> >
> > Lee
> >
> >
> >
> >
> >
> > Quoting "Petersson, Tobias" <Tobias.Petersson at laerdal.dk>:
> >
> >> Theres a lot of difference between.
> >>
> >> var a =
> >> {
> >>    var t = 5+5;
> >>    var s = 7-2;
> >>    t;
> >> }
> >>
> >>
> >> and
> >>
> >>
> >> {
> >>    var t = 5+5;
> >>    var s = 7-2;
> >>    t;
> >> }
> >>
> >> Peace!
> >> /T
> >>
> >> -----Original Message-----
> >> From: haxe-bounces at lists.motion-twin.com
> >> [mailto:haxe-bounces at lists.motion-twin.com] On Behalf Of
> >> lee at designrealm.co.uk
> >> Sent: den 6 december 2007 14:44
> >> To: haxe at lists.motion-twin.com
> >> Subject: RE: [haXe] Just a suggestion
> >>
> >> Oh yes you can. You see, many blocks or enclosed chunks of expressions
> >
> >> will often rely on the last value "expressed" in the previously
> >> executed block. If I had :
> >>
> >> {
> >>    var t = 5+5;
> >>    var s = 7-2;
> >>    t;
> >> }
> >>
> >> then the value of that block is 10. However, if I have
> >>
> >> {
> >>    var t = 5+5;
> >>    var s = 7-2;
> >> }
> >>
> >> Then the value is 5. Every single or block of code is an expression,
> >> so much "express" a value.
> >>
> >> Lee
> >>
> >>
> >>
> >>
> >>
> >> Quoting "Petersson, Tobias" <Tobias.Petersson at laerdal.dk>:
> >>
> >>> It does something it returns a function.
> >>> So you can't compare it to what I wrote.
> >>>
> >>> -----Original Message-----
> >>> From: haxe-bounces at lists.motion-twin.com
> >>> [mailto:haxe-bounces at lists.motion-twin.com] On Behalf Of
> >>> lee at designrealm.co.uk
> >>> Sent: den 6 december 2007 14:10
> >>> To: haxe at lists.motion-twin.com
> >>> Subject: Re: [haXe] Just a suggestion
> >>>
> >>> That's not a good idea. Imagine this scenario
> >>>
> >>> public function myFunctionGetter()
> >>> {
> >>>    return if( somecond )
> >>>    {
> >>>      S.instance.F1;
> >>>    }
> >>>    else
> >>>    {
> >>>      S.instance.F2;
> >>>    }
> >>> }
> >>>
> >>> You see, in haXe, there are no statements, only expressions. I rely
> >>> on
> >>
> >>> this a lot, so erroring the "no parenthesis" issue would reduce lots
> >>> of great functionality in haXe.  It's a plus, not an error!!!
> >>>
> >>> Lee
> >>>
> >>>
> >>>
> >>>
> >>> Quoting "Petersson, Tobias" <Tobias.Petersson at laerdal.dk>:
> >>>
> >>>> Just made an error which is kinda annoying.
> >>>>
> >>>> I have a singleton (S ) with a function ( F ) in it which I should
> >>> call.
> >>>> But I messed up and missed the parenthesis so this is the line:
> >>>>
> >>>> S.instance.F;
> >>>>
> >>>> Should have been:
> >>>>
> >>>> S.instance.F();
> >>>>
> >>>> Ofcourse this is not an error but the first line doesn't do anything
> >>> at
> >>>> all.
> >>>> So maybe it should be reported as some kind of an error  ( since
> >>>> there are no warnings in haXe ).
> >>>>
> >>>> Regards
> >>>> Tobias
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> 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
> >>
> >> --
> >> 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
> >
>
>
>
> --
>
> haXe - an open source web programming language
> http://haxe.org
>



-- 
Ralf Bokelberg <ralf.bokelberg at gmail.com>
Flex & Flash Consultant based in Cologne/Germany



More information about the Haxe mailing list