Re: ? 1={}, is there really any other interpretation?

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

Al Getz wrote:
> Not sure what you mean by being 'trolled'.
Don't worry about it. I just meant the uneasy self-important sensation that the
author is playing with me, that they could not possibly believe what they were
saying but instead deliberately crafting a message solely intended to provoke the
maximum retaliatory outburst. blink I probably spent too long reading that XP
patent thing yesterday, and as noted I have a long history of ranting on and on
and on about this topic...
> 
> > Clearly, ? 1={} *should* print FALSE
> 
> Well, lets look at another operation with an atom and a sequence...
> 
> ?1+{1,2,3} --prints "{2,3,4}" without the quotes
> 
If you want consistency then "1+{1,2,3}" should trigger an error, and much the
same way that we've all been forced for years to replace = with equal, force it
to be replaced with sq_add(1,{1,2,3}) or maybe 1 at +{1,2,3}.

> It is possible that i am a victim of my own programming techniques,
> in that the code i presented is only typical and not as general as
> it might imply.
As I said, "not previously infected with the flawed concept
of implicit sequence ops. [NB I said implicit.]"

Obviously, sq_eq(a,b) or a@=b are in contrast explicit sequence ops.

> Because of this i invite you to present some
> code that might make use of your suggestion of having 1={}
> return FALSE (or TRUE even).
Too easy:
function killFilter()
    if name="Pete Lomax" then
        return reply_to="Al Getz"
    end if
    return False
end function
integer flag
  flag=killFilter()

Almost everyone who has ever written some Eu code has tried something like that
only to first run into the dreaded "true/false condition must be ATOM"
then "type check error, flag is {1,1,1,1,1,1,1}", then "sequence lengths are not
the same (4!=7)" and so on.

Obviously if you are asking for a "1={}" example that cannot be trivially
replaced by "equal(1,{})" then there ain't one. The closest I can get:
if alen=1 then emit_one_byte_opcode()
  elsif alen=2 then emit_two_byte_opcode()
  elsif alen={} then fatal("no valid length for opcode")

The point is simply that the above is the most natural and elegant way to write
such code. I know you could easily fix it via equal() or using -1 for the error
case.

Regards,
Pete

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

Search



Quick Links

User menu

Not signed in.

Misc Menu