[haXe] Comparing enums using ==

Michael Pliskin pl at tepkom.ru
Thu Jul 27 16:30:43 CEST 2006


Hello list,

  I have one more language suggestion: I think it might be useful to
  be able to use == and != statement to compare enums with parameters
  as well, for instance:

  enum Test {
    a(x: Int);
    b(y: Int);
  }

  var z: test = Test.a(1);


  if (smth == Test.a(_)) {...}
  or even better
  if (smth == Test.a(1)) {...}

  The benefit of that is that one will be able to use enums in
  complicated conditional expressions which is useful. Now every time
  you need to test a enum value, you need to use a switch () statement
  which is rather large and not that readable.

-- 
Best regards,
 Michael                          mailto:pl at tepkom.ru




More information about the Haxe mailing list