Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #11114

Re: Which standard?

From Andrew Haley <andrew29@littlepinkcloud.invalid>
Subject Re: Which standard?
Newsgroups comp.lang.forth
References (3 earlier) <2012Mar26.110424@mips.complang.tuwien.ac.at> <m1i7s5.mvv@spenarnc.xs4all.nl> <jl4m35$uqf$1@news.albasani.net> <YNydnZ7vN6BzaejSnZ2dnUVZ_tmdnZ2d@supernews.com> <jm19ue$nre$1@news.albasani.net>
Message-ID <KdednWxB75Pl0xnSnZ2dnUVZ_hSdnZ2d@supernews.com> (permalink)
Date 2012-04-10 10:15 -0500

Show all headers | View raw


Marc Olschok <nobody@nowhere.invalid> wrote:
> Andrew Haley <andrew29@littlepinkcloud.invalid> wrote:
>> Marc Olschok <nobody@nowhere.invalid> wrote:
>> > Albert van der Horst <albert@spenarnc.xs4all.nl> wrote:
>> >> In article <2012Mar26.110424@mips.complang.tuwien.ac.at>,
>> >> Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>> >> >"Peter Knaggs" <pjk@bcs.org.uk> writes:
>> >> >>Although I would
>> >> >>have a significant problem with NOT due to its history.
>> >> >
>> >> >In theory, after some time of de-standardization of NOT that name
>> >> >should have cooled down enough that we should be able to give it a new
>> >> >standard meaning.
>> >> >
>> >> >In practice, the last time it was discussed, it turned out that some
>> >> >people thing that NOT should be INVERT and some people think that NOT
>> >> >should be 0=, so I doubt that we will reach a consensus even if
>> >> >someone makes a proposal.
>> >> 
>> >> NOT clearly is a logical transformation, so it should yield
>> >> a well-formed flag. Are there really people who think otherwise?
>> > 
>> > Yes, me for instance. The main reason is consistency across the logical
>> > operations. It would be strange to accept AND, OR and XOR as bitwise
>> > operations without expecting NOT to do likewise.
>> 
>> Mmm, I get that, but it's a very theoretical objection.  Surely the
>> ability to say NOT IF is far more important.  We already have INVERT .
> 
> Well, we also already have 0=. I agree that the phrase  NOT IF  is
> useful and would like to see NOT reintroduced, although I can live with
> having two distinct words INVERT and 0= in order to avoid confusion.
> But I do not quite see why this should force NOT to have the behaviour
> of 0= instead of INVERT, and my above point was just that considering
> NOT as logical operator does not in any prohibit this.
> 
> On the contrary, I would find it outright confusing if NOT did not
> operate bitwise just as AND and OR; and certainly the "principle of
> least surprise" is a quite practical one.

Surely the principle of least surprise says that "NOT IF" should do
something if and only if the condition is not true, i.e. all bits
zero.

> The important requirement for logical operators like NOT, AND or OR
> is not that they *produce* well formed flags regardless of the
> input, but that they *preserve* well formed flags. Those operations
> that must always produce well formed flags are relational operations
> like = , <> , 0= , 0<> etc..
> 
> But let's return to the example with NOT IF to see whether there is
> a problem at all. There are two possibilities:
> 
> (a) The previously produced TOS is a well formed flag. Then NOT will
> preserve this wff, whether it behaves as INVERT or as 0=.

Agreed.

> (b) The previously produced TOS is some computed number and most likely
> not a well formed flag. Then I would indeed prefer to use  0= IF  instead
> of  NOT IF  because the former is exactly what I am doing: I test if the
> TOS is equal to 0. Moreover, if I later look at the code   0= IF  will
> remind me that the previously computated TOS is perhaps not a well formed
> flag.
> 
> So basically, a NOT with behaviour of 0= would only make a difference in
> those situations where I would prefer to use the more informative  0=
> anyway. Hence my preference for a NOT with the behaviour of INVERT.

I wonder if this is an "English as a first language" thing?  :-)  As
Elizabeth said, NOT was invented precisely to allow you to say NOT IF,
and this is just to make the code easier to read than 0= IF .

Andrew.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Which standard? Marc Olschok <nobody@nowhere.invalid> - 2012-03-30 16:13 +0000
  Re: Which standard? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-30 13:01 -0500
    Re: Which standard? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-30 09:18 -1000
      Re: Which standard? Alex McDonald <blog@rivadpm.com> - 2012-03-30 14:11 -0700
    Re: Which standard? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-31 08:18 -0500
    Re: Which standard? Marc Olschok <nobody@nowhere.invalid> - 2012-04-10 12:43 +0000
      Re: Which standard? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-10 10:15 -0500
        Re: Which standard? "Elizabeth D. Rather" <erather@forth.com> - 2012-04-10 08:22 -1000
          Re: Which standard? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-10 14:03 -0500
            Re: Which standard? Alex McDonald <blog@rivadpm.com> - 2012-04-10 12:17 -0700
              Re: Which standard? "Elizabeth D. Rather" <erather@forth.com> - 2012-04-10 09:26 -1000
                Re: Which standard? Alex McDonald <blog@rivadpm.com> - 2012-04-11 06:22 -0700
            Re: Which standard? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-04-11 12:42 +0000
              Re: Which standard? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-11 09:40 -0500
                Re: Which standard? BruceMcF <agila61@netscape.net> - 2012-04-11 07:55 -0700
                Re: Which standard? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-11 11:28 -0500
      Re: Which standard? BruceMcF <agila61@netscape.net> - 2012-04-10 12:38 -0700
  Re: Which standard? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-04-03 09:27 +0000
    Re: Which standard? Marc Olschok <nobody@nowhere.invalid> - 2012-04-10 12:44 +0000

csiph-web