[fpc-pascal] Boolean expression short-circuit

2005-11-22 Thread Kornel Kisielewicz
Ok, I've been arguing over that with a friend of mine for a couple of e-mail's now... I need your help! Let me show an example first: type TFoo = class end; var Foo : TFoo; The question is, wether this is valid: if (Foo <> nil) and (Foo.inheritsFrom(TFoo)) then do_something; I would have no

Re: [fpc-pascal] Boolean expression short-circuit

2005-11-22 Thread Michalis Kamburelis
Kornel Kisielewicz wrote: Ok, I've been arguing over that with a friend of mine for a couple of e-mail's now... I need your help! Let me show an example first: type TFoo = class end; var Foo : TFoo; The question is, wether this is valid: if (Foo <> nil) and (Foo.inheritsFrom(TFoo)) then do_

Re: [fpc-pascal] Boolean expression short-circuit

2005-11-22 Thread Kornel Kisielewicz
Michalis Kamburelis wrote: Can I make the assumption that boolean expressions are GUARANTEED to be evaluated left-to-right? > > Yes. Thanks, I guess I lost the argument :]. Anyway, I guess it wouldn't hurt to clarify that just a little bit in the manual :-/ -- At your service, Kornel Kisielew

Re: [fpc-pascal] Boolean expression short-circuit

2005-11-22 Thread Matt Emson
> Thanks, I guess I lost the argument :]. Anyway, I guess it wouldn't hurt > to clarify that just a little bit in the manual :-/ However, IIRC "complete boolean eval" (which is what delphi calls it) would blow the code up, as even if Foo was nil, the second half would be evaluated regardless. May

Re: [fpc-pascal] Boolean expression short-circuit

2005-11-22 Thread Michael Van Canneyt
On Tue, 22 Nov 2005, Kornel Kisielewicz wrote: Michalis Kamburelis wrote: Can I make the assumption that boolean expressions are GUARANTEED to be evaluated left-to-right? Yes. Thanks, I guess I lost the argument :]. Anyway, I guess it wouldn't hurt to clarify that just a little bit in th

Re: [fpc-pascal] for..in loops?

2005-11-22 Thread Peter Vreman
At 14:04 20-11-2005, you wrote: Florian Klaempfl wrote: Lukas Gebauer wrote: enhancements in Delphi-2006... (like operator overloads or class variables...) ... which has fpc for years :) I didn't know that. How do I declare a class variable in fpc? like this? type MyClass = class(TCompon

Re: [fpc-pascal] for..in loops?

2005-11-22 Thread Vincent Snijders
Peter Vreman wrote: At 14:04 20-11-2005, you wrote: Florian Klaempfl wrote: Lukas Gebauer wrote: enhancements in Delphi-2006... (like operator overloads or class variables...) ... which has fpc for years :) I didn't know that. How do I declare a class variable in fpc? like this? type