[fpc-pascal] precedence "is" and "and"

2018-12-08 Thread Mattias Gaertner via fpc-pascal
Hi, According to the docs, the "is" operator is fourth level, the "and" is second level, so the "and" must be computed before the "is". But it seems fpc treats "is" and "and" as same level: {$mode objfpc} uses Classes; var b: boolean; o: TObject; begin // this compiles, but should fail: i

Re: [fpc-pascal] precedence "is" and "and"

2018-12-08 Thread Mattias Gaertner via fpc-pascal
On Sat, 8 Dec 2018 20:38:23 +0100 Mattias Gaertner via fpc-pascal wrote: >[...] > According to the docs, the "is" operator is fourth level, the "and" is > second level, so the "and" must be computed before the "is". But it > seems fpc treats "is" and "and" as same level: >[...] Btw, there is a d

Re: [fpc-pascal] precedence "is" and "and"

2018-12-08 Thread Mattias Gaertner via fpc-pascal
On Sat, 8 Dec 2018 20:38:23 +0100 Mattias Gaertner via fpc-pascal wrote: > Hi, > > According to the docs, the "is" operator is fourth level, the "and" is > second level, so the "and" must be computed before the "is". Link: https://www.freepascal.org/docs-html/ref/refch12.html Mattias

Re: [fpc-pascal] precedence "is" and "and"

2018-12-08 Thread Marco van de Voort
Op 2018-12-08 om 20:38 schreef Mattias Gaertner via fpc-pascal: According to the docs, the "is" operator is fourth level, the "and" is second level, so the "and" must be computed before the "is". But it seems fpc treats "is" and "and" as same level: logical (boolean) vs bitwise AND difference?

Re: [fpc-pascal] precedence "is" and "and"

2018-12-08 Thread Mattias Gaertner via fpc-pascal
On Sat, 8 Dec 2018 21:23:57 +0100 Marco van de Voort wrote: > Op 2018-12-08 om 20:38 schreef Mattias Gaertner via fpc-pascal: > > According to the docs, the "is" operator is fourth level, the "and" > > is second level, so the "and" must be computed before the "is". But > > it seems fpc treats "is

Re: [fpc-pascal] precedence "is" and "and"

2018-12-08 Thread Michael Van Canneyt
On Sat, 8 Dec 2018, Mattias Gaertner via fpc-pascal wrote: On Sat, 8 Dec 2018 21:23:57 +0100 Marco van de Voort wrote: Op 2018-12-08 om 20:38 schreef Mattias Gaertner via fpc-pascal: > According to the docs, the "is" operator is fourth level, the "and" > is second level, so the "and" must b

Re: [fpc-pascal] precedence "is" and "and"

2018-12-08 Thread Mattias Gaertner via fpc-pascal
On Sat, 8 Dec 2018 22:03:11 +0100 (CET) Michael Van Canneyt wrote: >[...] > In delphi, AS is second level, and 'is' is fourth level. > > http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Expressions_(Delphi) > > If FPC does this differently, then I think this is an incompatibility. What has "a

Re: [fpc-pascal] precedence "is" and "and"

2018-12-08 Thread Martin Wynne
var b: boolean; o: TObject; begin // this compiles, but should fail: if o is TComponent and b then ; It will compile if $BOOLEVAL is on the default (-) because the result can be determined without considering precedence, see: https://www.freepascal.org/docs-html/prog/progsu4.ht

Re: [fpc-pascal] precedence "is" and "and"

2018-12-09 Thread Marco van de Voort
Op 2018-12-08 om 22:03 schreef Michael Van Canneyt: I don't see where the bitwise should be involved here. There is no integer. The docs do not mention a different precedence lvl for logical/bitwise "and". My line of thought was the docs might mean bitwise there. Because to the best of my

Re: [fpc-pascal] precedence "is" and "and"

2018-12-09 Thread Michael Van Canneyt
On Sun, 9 Dec 2018, Marco van de Voort wrote: Because to the best of my knowledge, here isn't any difference in precedence, so there is nothing to explain. And that was what my post was, checking that. I'm more of the "more parenthesis never hurt anybody" school, so operator precedence b

Re: [fpc-pascal] precedence "is" and "and"

2018-12-08 Thread Michael Van Canneyt
On Sat, 8 Dec 2018, Mattias Gaertner via fpc-pascal wrote: On Sat, 8 Dec 2018 22:03:11 +0100 (CET) Michael Van Canneyt wrote: [...] In delphi, AS is second level, and 'is' is fourth level. http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Expressions_(Delphi) If FPC does this differently,