Re: Why not == ?

new topic     » goto parent     » topic index » view thread      » older message » newer message

A long time ago I had made a custom Euphoria interpreter that converted a = b to equal(a, b) when the operator was used inside an if or while statement. IIRC it may have had some bugs and I'm pretty sure I've since lost the code.

This is something I'd like to see implemented and I don't think it would break much existing code since boolean statements have to be atoms and all binary operations on sequences return a sequence or cause an error (if sequence lengths do not match).

I think the potential problems come from the reverse: statements like foo = a = b where a and b are equal-length sequences so foo would return a sequence as well. I think the solution here is two-fold:

  1. Only use = for boolean operations on sequences inside if and while statements.
  2. Issue a warning for statements like foo = a = b that equal() should be used instead.
  3. Possibly remove support for foo = a = b statements sometime later?

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu