Re: Short Circuit

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

On 6 Oct 2000, at 4:45, David Cuny wrote:

I can't believe i have some points to counter you on, David..

<snip>

> (1) The '=' comparison is worthless. You can only compare sequences that are
> *exactly* the same in structure, with exactly the same lengths, down to the
> last nested subsequence. I challange anyone to find me an example where this
> is actually useful, other than for performing obscure tricks with bitmaps.

if ( c:\file.orig = q:\file.bak ) then erase( c:\file.orig ) end if

> (Sorry, no prizes will be given to the winning entries.)

Drat.

> (3) The code shouldn't return an error. To be consistant (for example, with
> 'gets'), it should return an integer on failure, and a sequence on success.

Agreed,
if ( operator(x,y) != error )
  then  -- working code
  else -- error recovery code
end if

But,, what will the error code be that cannot be returned by a valid legal
comparison?

> (4) The '=' operator doesn't work the way people want it to. And, in the
> end, the needs of the users should drive the design of the language, not the
> other way around.

YEA!!,, like having a goto ! Thanks, David smile

> (5) Short-circuiting should be consistant. It goes against the basic idea of
> Euphoria (and simple consistancy) to have a keyword sometimes do one thing,
> and sometimes do another.

Short circuiting should be transparent to the programmer/user. I set it 'on' in
Pascal of
years, and saw no difference other than speed.

> (1) Change the behavior of '=' so it acts like 'equal'. It (and it's kin)
> only return boolean integer values.

Despite my initial thought of returning a percentage of trueness, a binary
true/false is
the best way, trueness otherwise would be too subjective.

> (2) Add the following functions to replace the old '=' behavior:
>
>    compare_seq( o1, o2 )
>    equal_seq( o1, o2 )

RPN? Ptui. Why not plain old

if ( o1 = o2 )  then -- code -- end if

> (3) Change 'and' and 'or' so they only accept integers, and only return
> boolean integers.

Ewwww, that could kill off video effects manipulation! Errr,, unless you are
counting a
bitmap as one huge integer. Subsequences are a different matter, prolly.

Kat

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

Search



Quick Links

User menu

Not signed in.

Misc Menu