Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread Flávio Etrusco
On Feb 2, 2016 7:41 PM, "geneb" wrote: > > (...) > > So it's not solving a /problem/ it's lessening an inconvienence(sp!). > > I would've gone with IIf(). :) > > > g. > The problem with Iff() is: 1) it either retains normal function behavior and thus has to evaluate both expressions (i.e. subopti

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread silvioprog
etrusco wrote > On Feb 2, 2016 7:41 PM, "geneb" < > geneb@ > > wrote: > [...] > The problem with Iff() is:1) it either retains normal function behavior > and thus has to evaluate both expressions (i.e. suboptimal performance and > allowing side effects); Well: program Project1; function test1:

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread Dmitry Boyarintsev
On Tue, Feb 2, 2016 at 4:40 PM, geneb wrote: > So it's not solving a /problem/ it's lessening an inconvienence(sp!). > > I would've gone with IIf(). :) > Just keep in mind that the thread (about preferences) is closed. Everyone are welcomed to create poll on the forum. Discussion also goes on at

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread geneb
On Tue, 2 Feb 2016, Sven Barth wrote: Yes, you can, because mails towards the list can be set to be moderated based on different criteria and I bet that the thread ID is one of them. Jonas (as list admin) probably did just that. Mailman (at least version 2.1.20, which is what I run) doesn't wor

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread geneb
On Tue, 2 Feb 2016, Dmitry Boyarintsev wrote: On Tue, Feb 2, 2016 at 4:40 PM, geneb wrote: So it's not solving a /problem/ it's lessening an inconvienence(sp!). I would've gone with IIf(). :) Just keep in mind that the thread (about preferences) is closed. You can't "close" a discussion

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread Sven Barth
Am 02.02.2016 22:51 schrieb "geneb" : > > On Tue, 2 Feb 2016, Dmitry Boyarintsev wrote: > >> On Tue, Feb 2, 2016 at 4:40 PM, geneb wrote: >> >>> So it's not solving a /problem/ it's lessening an inconvienence(sp!). >>> >>> I would've gone with IIf(). :) >>> >> >> Just keep in mind that the thread

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread geneb
On Tue, 2 Feb 2016, Dmitry Boyarintsev wrote: On Tue, Feb 2, 2016 at 4:07 PM, geneb wrote: I probably missed it, but what problem is "IfThen()" actually solving? It's a sugar syntax, for if cond then x:= a else x:=b; Just follow this thread: http://lists.freepascal.org/pipermail/fpc-pas

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread John Lee
So (Sven) to clarify, assume that your original ifthen [patch is now in latest svn compiler although more work will needed to do x:=if a then b else c;? j On 2 February 2016 at 18:33, Sven Barth wrote: > On 02.02.2016 10:25, Michael Schnell wrote: > > On 02/01/2016 09:35 PM, Maciej Izak wrote: >

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread Dmitry Boyarintsev
On Tue, Feb 2, 2016 at 4:07 PM, geneb wrote: I probably missed it, but what problem is "IfThen()" actually solving? > > It's a sugar syntax, for if cond then x:= a else x:=b; Just follow this thread: http://lists.freepascal.org/pipermail/fpc-pascal/2016-January/046375.html Pro #1: shortnes

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread John Lee
Based on Florian's recent emails the if then else is ok, so guess we should be close to getting it all running. Great, thanks for your efforts. j On 2 February 2016 at 20:55, Sven Barth wrote: > On 02.02.2016 20:22, John Lee wrote: > > So (Sven) to clarify, assume that your original ifthen [patc

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread geneb
On Tue, 2 Feb 2016, Sven Barth wrote: On 02.02.2016 20:22, John Lee wrote: So (Sven) to clarify, assume that your original ifthen [patch is now in latest svn compiler although more work will needed to do x:=if a then b else c;? j The IfThen() is in trunk though it will at least be renamed. Th

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread Sven Barth
On 02.02.2016 20:22, John Lee wrote: > So (Sven) to clarify, assume that your original ifthen [patch is now in > latest svn compiler although more work will needed to do x:=if a then b > else c;? j The IfThen() is in trunk though it will at least be renamed. The if-then-else expression would in t

[fpc-pascal] The IfThen() thread is now closed

2016-02-02 Thread Jonas Maebe
Hi, I think that everyone has had ample opportunities to exchange their views on this topic, so it's now closed on this list. If you want to discuss it further, you can do so on the fpc-other list. Thanks, Jonas FPC mailing lists admin ___ fpc-pas

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread Michael Schnell
On 02/01/2016 09:35 PM, Maciej Izak wrote: x := if true then 0 else 1 Here a keyword and a statement just optionally returns a value, Same is ignored in all legacy code but can be use it you want to and do know what you do. Additionally "0" now is a statement, (optionally) extending what

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Schnell
On 02/02/2016 10:31 AM, Graeme Geldenhuys wrote: Exactly! I'm glad somebody noticed that too. Of course I did notice :-) . V := If a < 3 then 1 else 2; In fact extends a several language paradigms: - a keyword (such as "if") returns a value - a statement (such as "if ", and the conte

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread John Lee
on, and on and on blah blah - lets move on! On 2 February 2016 at 17:06, Martin wrote: > On 02/02/2016 16:49, Sven Barth wrote: > >> >> >> > also if we are discussing (are we?) a form like >> > x:= iIf a>b iThen c iElse b; >> > then why not >> > x:= a>b ifThen c ifElse b; >> >> Because I

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Martin
On 02/02/2016 16:49, Sven Barth wrote: > also if we are discussing (are we?) a form like > x:= iIf a>b iThen c iElse b; > then why not > x:= a>b ifThen c ifElse b; Because I won't add new keywords just for this feature, especially if they are inside normal code (I'm a bit less strict o

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Lukasz Sokol
On 02/02/16 16:28, Lukasz Sokol wrote: > (bikeshedding mode=on) > > On 02/02/16 11:24, Marcos Douglas wrote: >> On Tue, Feb 2, 2016 at 7:49 AM, Michael Van Canneyt >> wrote: >>> It is not a statement, it is an expression. >>> >>> I prefer >>> x := iif Obj = nil then 0 else Obj.Value; >>> over >

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 15:39 schrieb "Serguei TARASSOV" : > > On 02/02/2016 15:16, fpc-pascal-requ...@lists.freepascal.org wrote: >> >> Date: Tue, 2 Feb 2016 14:36:25 +0100 >> From: Sven Barth >> >> >>> > >>> >You confuse left-to-right operator's precedence with function arguments evaluation >>> . >> >> No,

Re: [fpc-pascal] if-then-else expression

2016-02-02 Thread Sven Barth
On 02.02.2016 10:25, Michael Schnell wrote: > On 02/01/2016 09:35 PM, Maciej Izak wrote: >> >> >> x := if true then 0 else 1 > > Here a keyword and a statement just optionally returns a value, Same is > ignored in all legacy code but can be use it you want to and do know > what you do. > > Additi

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Lukasz Sokol
(bikeshedding mode=on) On 02/02/16 11:24, Marcos Douglas wrote: > On Tue, Feb 2, 2016 at 7:49 AM, Michael Van Canneyt > wrote: >> It is not a statement, it is an expression. >> >> I prefer >> x := iif Obj = nil then 0 else Obj.Value; >> over >> x := if Obj = nil then 0 else Obj.Value; >> >> B

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Marcos Douglas
On Tue, Feb 2, 2016 at 4:10 PM, Martin wrote: > Also there are many who want assignments > X := inline y := 1; > Now that might be looking nice if all you do is set 10 variables to 1. > But > x := inline if inline y := foo() > inline z := bar() then inline m:= 1 else > inline m:=2; > *OUCH*!! As

Re: [fpc-pascal] Error compiling FPC trunk under Linux

2016-02-02 Thread Fabio Luis Girardi
I'll do that. Sorry for the noise. 2016-02-02 16:15 GMT-02:00 Jonas Maebe : > Fabio Luis Girardi wrote: > >> >> >> 2016-02-02 16:07 GMT-02:00 Jonas Maebe > >: >> >> >> What is the version of your starting compiler? >> >> >> 3.1.1 revision 32800. I don't reme

Re: [fpc-pascal] Error compiling FPC trunk under Linux

2016-02-02 Thread Jonas Maebe
Fabio Luis Girardi wrote: 2016-02-02 16:07 GMT-02:00 Jonas Maebe mailto:jonas.ma...@elis.ugent.be>>: What is the version of your starting compiler? 3.1.1 revision 32800. I don't remember the revision the compiler that built this last one, but it's 3.1.1 too. Building a development ver

Re: [fpc-pascal] Error compiling FPC trunk under Linux

2016-02-02 Thread Sven Barth
On 02.02.2016 19:12, Fabio Luis Girardi wrote: > > > 2016-02-02 16:07 GMT-02:00 Jonas Maebe >: > > > What is the version of your starting compiler? > > > 3.1.1 revision 32800. I don't remember the revision the compiler that > built this last one, but it'

Re: [fpc-pascal] Error compiling FPC trunk under Linux

2016-02-02 Thread Fabio Luis Girardi
2016-02-02 16:07 GMT-02:00 Jonas Maebe : > > > What is the version of your starting compiler? > > 3.1.1 revision 32800. I don't remember the revision the compiler that built this last one, but it's 3.1.1 too. -- The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/proj

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Martin
On 02/02/2016 17:35, Marcos Douglas wrote: On Tue, Feb 2, 2016 at 3:06 PM, Martin wrote: In this case, I dislike the x := if a then b else c; Why not as below, using 'inline' keyword? x := inline if a then b else c; because it still resembles a statement. (even so, I guess technical

Re: [fpc-pascal] Error compiling FPC trunk under Linux

2016-02-02 Thread Jonas Maebe
Fabio Luis Girardi wrote: I'm trying to build FPC on linux x64, using makepack script, but I have Internal error 2007020810. Bellow the script output: What is the version of your starting compiler? Jonas ___ fpc-pascal maillist - fpc-pascal@lists.

[fpc-pascal] Error compiling FPC trunk under Linux

2016-02-02 Thread Fabio Luis Girardi
Hi! I'm trying to build FPC on linux x64, using makepack script, but I have Internal error 2007020810. Bellow the script output: /usr/bin/ppcx64 -Ur -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -Fi../unix -Fix86_64 -FE. -FU/home/felipe/fpcbuild/fpcsrc/rtl/units/x86_64-linux -Cg -dx86_64 -dRELEASE ../obj

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Jürgen Hestermann
Am 2016-02-02 um 18:39 schrieb Maciej Izak: Is possible to close thread on mailing list? -,- Simply do not open (and delete) mails with "IfThen" in subject. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Maciej Izak
Is possible to close thread on mailing list? -,- -- Best regards, Maciej Izak ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Marcos Douglas
On Tue, Feb 2, 2016 at 3:06 PM, Martin wrote: > In this case, I dislike the >x := if a then b else c; Why not as below, using 'inline' keyword? x := inline if a then b else c; It is simple and elegant; Is different than a simple 'if'; Could be used to extend 'case' too; Don't looks like

Re: [fpc-pascal] Updated Lexical Diagrams

2016-02-02 Thread Graeme Geldenhuys
On 2016-02-02 15:06, Anthony Walter wrote: > It's totally incomplete, there is a heck of a lot missing, but I think it's > good start. It definitely looks better than the previous one. Speaking of "a lot missing" Program Header is incomplete. You are allowed to have a Identifier List in braces a

[fpc-pascal] [PATCH] TFPSMap.Find can't find an item when the second key is bigger than first one

2016-02-02 Thread silvioprog
Hello, Issue ID: #29575 . Thank you! PS. Please delete the wrong attached patch `0001-misc-single-and-double-helpers.-No-endianess-atm.patch` keeping only the `0001-Fix-bug-ID-29575.-Patch-from-Silvio-Clecio.patch`. -- Silvio Clécio ___

[fpc-pascal] [ISSUE] Access Violation in a fpcunitproject1 using the heaptrc unit

2016-02-02 Thread silvioprog
Hello, Issue ID: #29558 . Thank you! -- Silvio Clécio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Updated Lexical Diagrams

2016-02-02 Thread Anthony Walter
Thanks for the props. I'm working on three new high quality training videos right now. I'll probably edit them at once and post them spaced over the next week. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Martin wrote: On 02/02/2016 16:49, Sven Barth wrote: > also if we are discussing (are we?) a form like > x:= iIf a>b iThen c iElse b; > then why not > x:= a>b ifThen c ifElse b; Because I won't add new keywords just for this feature, especially if they are insid

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 16:11 schrieb "Martin" : > > On 02/02/2016 13:24, Sven Barth wrote: >> >> >> > Look at the "iif" as an statement and the things will be simple. >> >> BECAUSE. IT. IS. *NOT*. A. STATEMENT! >> It never was and it never will be! It returns a value and thus by definition it is an expressi

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Jürgen Hestermann
Am 2016-02-02 um 11:41 schrieb Mark Morgan Lloyd: > Michael Van Canneyt wrote: > Yes, and that's why to get the desired semantics it's more appropriate to use if then else rather than iif() etc. > Please correct me if I'm wrong, but my understanding is that in all cases where parameters are

Re: [fpc-pascal] Parameter evaluation order

2016-02-02 Thread Vojtěch Čihák
It is guaranted for boolean operators with short-evaluation (if you mean this). See: http://www.freepascal.org/docs-html/ref/refsu48.html#x150-17200012.8.3   V. __ Od: Andreas Berger Komu: Datum: 02.02.2016 13:57 Předmět: Re: [fpc-pasc

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Andreas Berger
On Tue 02/02/2016 10:52, Serguei TARASSOV wrote: On 02/02/2016 13:41, fpc-pascal-requ...@lists.freepascal.org wrote: Date: Tue, 02 Feb 2016 10:32:28 -0200 From: Andreas Berger On Tue 02/02/2016 09:27, Jonas Maebe wrote: > >The parameter evaluation order issue is irrelevant in this context: >D

Re: [fpc-pascal] Updated Lexical Diagrams

2016-02-02 Thread silvioprog
On Tue, Feb 2, 2016 at 12:06 PM, Anthony Walter wrote: > I've posted the first copy of my pascal lexical diagrams: > > http://www.getlazarus.org/learn/language/lexical/ > > It's totally incomplete, there is a heck of a lot missing, but I think > it's good start. > > If you want to make new diagra

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Martin Schreiber wrote: On Tuesday 02 February 2016 13:39:17 Michael Van Canneyt wrote: On Tue, 2 Feb 2016, Martin Schreiber wrote: On Tuesday 02 February 2016 13:22:01 Jonas Maebe wrote: It just needs to be documented properly. It is a non-issue for me. It is a deal b

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Martin
On 02/02/2016 13:24, Sven Barth wrote: > Look at the "iif" as an statement and the things will be simple. BECAUSE. IT. IS. *NOT*. A. STATEMENT! It never was and it never will be! It returns a value and thus by definition it is an expression! +1 And imho that why it is important that it doe

[fpc-pascal] Updated Lexical Diagrams

2016-02-02 Thread Anthony Walter
I've posted the first copy of my pascal lexical diagrams: http://www.getlazarus.org/learn/language/lexical/ It's totally incomplete, there is a heck of a lot missing, but I think it's good start. If you want to make new diagrams or edit the existing one use the edit page feature. You may have to

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Serguei TARASSOV
On 02/02/2016 13:41, fpc-pascal-requ...@lists.freepascal.org wrote: Date: Tue, 02 Feb 2016 13:22:01 +0100 From: Jonas Maebe Michael Van Canneyt wrote on Tue, 02 Feb 2016: [evaluating all arguments to a function/intrinsic] >I'm just trying to to put any foaming-at-the-mouth argumentation >using

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Serguei TARASSOV
On 02/02/2016 13:41, fpc-pascal-requ...@lists.freepascal.org wrote: Date: Tue, 02 Feb 2016 10:32:28 -0200 From: Andreas Berger On Tue 02/02/2016 09:27, Jonas Maebe wrote: > >The parameter evaluation order issue is irrelevant in this context: >Delphi guarantees left-to-right (or used to anyway,

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Henry Vermaak
On Tue, Feb 02, 2016 at 01:12:25PM +0100, Michael Van Canneyt wrote: > On Tue, 2 Feb 2016, Henry Vermaak wrote: > >So you are saying that relying on all function arguments being > >evaluated is bad? > > I am saying that the difference between this behaviour and the > behaviour where they may not a

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Martin Schreiber
On Tuesday 02 February 2016 13:22:01 Jonas Maebe wrote: > Michael Van Canneyt wrote on Tue, 02 Feb 2016: > > [evaluating all arguments to a function/intrinsic] > > > I'm just trying to to put any foaming-at-the-mouth argumentation > > using this particular argument in perspective. > > I think this

[fpc-pascal] Parameter evaluation order

2016-02-02 Thread Jonas Maebe
Andreas Berger wrote on Tue, 02 Feb 2016: On Tue 02/02/2016 09:27, Jonas Maebe wrote: The parameter evaluation order issue is irrelevant in this context: Delphi guarantees left-to-right (or used to anyway, this may have changed), FPC doesn't guarantee anything. Wow, what's this? I never

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Martin Schreiber wrote: On Tuesday 02 February 2016 13:22:01 Jonas Maebe wrote: It just needs to be documented properly. It is a non-issue for me. It is a deal breaker for me. Agreed. Quick ! We should call the New York Times or Frankfurter Allgemeiner Zeitung, M

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Andreas Berger wrote: On Tue 02/02/2016 09:27, Jonas Maebe wrote: The parameter evaluation order issue is irrelevant in this context: Delphi guarantees left-to-right (or used to anyway, this may have changed), FPC doesn't guarantee anything. Wow, what's this? I never

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Serguei TARASSOV
On 02/02/2016 15:16, fpc-pascal-requ...@lists.freepascal.org wrote: Date: Tue, 2 Feb 2016 14:36:25 +0100 From: Sven Barth > >You confuse left-to-right operator's precedence with function arguments evaluation . No, he does not. Delphi and TP indeed guarantee an evaluation(!) from left to right

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Jonas Maebe wrote: Michael Van Canneyt wrote on Tue, 02 Feb 2016: [evaluating all arguments to a function/intrinsic] I'm just trying to to put any foaming-at-the-mouth argumentation using this particular argument in perspective. I think this is rather disingenuous afte

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Maciej Izak
2016-02-02 13:12 GMT+01:00 Michael Van Canneyt : > "iif(a,b,c) > is fundamentally different in behaviour from > functionxyy(a,b,c)" > > simply laughable in my eyes, because likely 99,99% of programmers won't > know the > difference. As Graeme said: 'I guess I was just lucky it never happened to >

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > >> Including all other functions called iif(). > >> > >>> >It just needs to be > >>> >documented properly. It is a non-issue for me. > >> It is a deal breaker for me. > > Completely agreed with Jonas. > > I'm afraid to stay with FPC 2.6 for the

Re: [fpc-pascal] fpc-pascal Digest, Vol 140, Issue 27

2016-02-02 Thread Serguei TARASSOV
On 02/02/2016 14:33, fpc-pascal-requ...@lists.freepascal.org wrote: Date: Tue, 2 Feb 2016 14:24:18 +0100 From: Sven Barth > >Why make the things complex? Why create another "special case"? >Look at the "iif" as an statement and the things will be simple. BECAUSE. IT. IS.*NOT*. A. STATEMENT! It

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Dmitry Boyarintsev
On Tue, Feb 2, 2016 at 7:45 AM, Henry Vermaak wrote: > Exceptions to standard behaviour is bad, just because there are > exceptions doesn't mean that we need to create more of them. > Documenting something doesn't make the behaviour intuitive. > > Too many exceptions create a rule? :) I'd suspec

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 13:56 schrieb "Serguei TARASSOV" : > > On 02/02/2016 13:41, fpc-pascal-requ...@lists.freepascal.org wrote: >> >> Date: Tue, 02 Feb 2016 13:22:01 +0100 >> From: Jonas Maebe >> >> Michael Van Canneyt wrote on Tue, 02 Feb 2016: >> >> [evaluating all arguments to a function/intrinsic] >>

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Sven Barth wrote: Am 02.02.2016 13:38 schrieb "Andreas Berger" : On Tue 02/02/2016 09:27, Jonas Maebe wrote: The parameter evaluation order issue is irrelevant in this context: Delphi guarantees left-to-right (or used to anyway, this may have changed), FPC doesn't gu

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 13:51 schrieb "Serguei TARASSOV" : > > On 02/02/2016 13:41, fpc-pascal-requ...@lists.freepascal.org wrote: >> >> Date: Tue, 02 Feb 2016 10:32:28 -0200 >> From: Andreas Berger >> >> >> On Tue 02/02/2016 09:27, Jonas Maebe wrote: >>> >>> > >>> >The parameter evaluation order issue is ir

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 13:38 schrieb "Andreas Berger" : > > > On Tue 02/02/2016 09:27, Jonas Maebe wrote: >> >> >> The parameter evaluation order issue is irrelevant in this context: Delphi guarantees left-to-right (or used to anyway, this may have changed), FPC doesn't guarantee anything. >> > Wow, what's

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread John Lee
Sigh, thought everyone (eventually) agreed that we'd change to algol/ada x:=if a>b then 1 else 2; so why are we going on & on & on about this? john On 2 February 2016 at 13:20, Sven Barth wrote: > Am 02.02.2016 11:42 schrieb "Mark Morgan Lloyd" < > markmll.fpc-pas...@telemetry.co.uk>: > > > > M

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 12:03 schrieb "Serguei TARASSOV" : > > On 02/02/2016 11:42, fpc-pascal-requ...@lists.freepascal.org wrote: >> >> On Tue, 2 Feb 2016, Sven Barth wrote: >> >> >No, the second is always better because safer. >> > >> >x := iif (Obj = nil, 0, Obj.Value); >> >This will raise access violatio

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 11:42 schrieb "Mark Morgan Lloyd" < markmll.fpc-pas...@telemetry.co.uk>: > > Michael Van Canneyt wrote: > >> Call me old fashioned, but then I think >> foo:=iif(Condition1, >>iif(Condition2, ThenExpr1, ElseExpr1), >>iif(Condition3, ThenExpr2, ElseExpr2)); >>

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Serguei TARASSOV wrote: On 02/02/2016 13:41, fpc-pascal-requ...@lists.freepascal.org wrote: Date: Tue, 02 Feb 2016 13:22:01 +0100 From: Jonas Maebe Michael Van Canneyt wrote on Tue, 02 Feb 2016: [evaluating all arguments to a function/intrinsic] >I'm just trying to to p

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Henry Vermaak wrote: On Tue, Feb 02, 2016 at 01:12:25PM +0100, Michael Van Canneyt wrote: On Tue, 2 Feb 2016, Henry Vermaak wrote: So you are saying that relying on all function arguments being evaluated is bad? I'm just trying to to put any foaming-at-the-mouth argume

Re: [fpc-pascal] Parameter evaluation order

2016-02-02 Thread Andreas Berger
On Tue 02/02/2016 10:41, Jonas Maebe wrote: Andreas Berger wrote on Tue, 02 Feb 2016: On Tue 02/02/2016 09:27, Jonas Maebe wrote: The parameter evaluation order issue is irrelevant in this context: Delphi guarantees left-to-right (or used to anyway, this may have changed), FPC doesn't gua

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Martin Schreiber
On Tuesday 02 February 2016 13:39:17 Michael Van Canneyt wrote: > On Tue, 2 Feb 2016, Martin Schreiber wrote: > > On Tuesday 02 February 2016 13:22:01 Jonas Maebe wrote: > >>> It just needs to be > >>> documented properly. It is a non-issue for me. > >> > >> It is a deal breaker for me. > > > > Agr

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Andreas Berger
On Tue 02/02/2016 09:27, Jonas Maebe wrote: The parameter evaluation order issue is irrelevant in this context: Delphi guarantees left-to-right (or used to anyway, this may have changed), FPC doesn't guarantee anything. Wow, what's this? I never knew this. I have been using Borland products

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Jonas Maebe
Michael Van Canneyt wrote on Tue, 02 Feb 2016: [evaluating all arguments to a function/intrinsic] I'm just trying to to put any foaming-at-the-mouth argumentation using this particular argument in perspective. I think this is rather disingenuous after your own foaming-at-the-mouth hyperbol

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Henry Vermaak wrote: You only talked about the order of evaluation in that mail, while Henry is talking about whether the arguments are evaluated at all. I am aware of that (I knew I should have mentioned it explicitly, this is a programmers list!), but the exact same ob

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread silvioprog
On Tue, Feb 2, 2016 at 6:49 AM, Michael Van Canneyt wrote: [...] > No, the second is always better because safer. >> >> x := iif (Obj = nil, 0, Obj.Value); >> This will raise access violation as a normal function or you depend on >> compiler implementation for this special case. And you should re

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Marcos Douglas
On Tue, Feb 2, 2016 at 8:32 AM, Sven Barth wrote: > It's not a statement, it's an expression. Also I won't introduce a new > keyword ("iif") just for this. Thank you for this. Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org h

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread silvioprog
On Tue, Feb 2, 2016 at 6:07 AM, Michael Van Canneyt wrote: > On Tue, 2 Feb 2016, Maciej Izak wrote: > >> we can even mix to gain more clear code: >> >> foo := >> if Condition1 then >>iif(Condition2, ThenExpr1, ElseExpr1) >> else >>iif(Condition3, ThenExpr2, ElseExpr2); >> >> much more r

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Mark Morgan Lloyd
Michael Van Canneyt wrote: On Tue, 2 Feb 2016, Mark Morgan Lloyd wrote: The "if then" construct is really confusing. "if then" is a statement, not an expression. Yes, and that's why to get the desired semantics it's more appropriate to use if then else rather than iif() etc. Please cor

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Henry Vermaak
On Tue, Feb 02, 2016 at 12:34:17PM +0100, Michael Van Canneyt wrote: > On Tue, 2 Feb 2016, Jonas Maebe wrote: > >Michael Van Canneyt wrote on Tue, 02 Feb 2016: > >>On Tue, 2 Feb 2016, Henry Vermaak wrote: > >>>On Tue, Feb 02, 2016 at 11:24:57AM +0100, Michael Van Canneyt > >>>wrote: > On Tue, 2

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Henry Vermaak wrote: On Tue, Feb 02, 2016 at 12:03:14PM +0100, Michael Van Canneyt wrote: On Tue, 2 Feb 2016, Henry Vermaak wrote: When you call a function all the arguments get evaluated before the function gets called. iif will look exactly like a function call, but al

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Jonas Maebe wrote: Michael Van Canneyt wrote on Tue, 02 Feb 2016: On Tue, 2 Feb 2016, Henry Vermaak wrote: On Tue, Feb 02, 2016 at 11:24:57AM +0100, Michael Van Canneyt wrote: On Tue, 2 Feb 2016, Henry Vermaak wrote: Pascal is not a language full of programmer traps

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Henry Vermaak
On Tue, Feb 02, 2016 at 12:03:14PM +0100, Michael Van Canneyt wrote: > On Tue, 2 Feb 2016, Henry Vermaak wrote: > >When you call a function all the arguments get evaluated before the > >function gets called. iif will look exactly like a function call, > >but all the arguments may not be evaluated

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Jonas Maebe
Michael Van Canneyt wrote on Tue, 02 Feb 2016: On Tue, 2 Feb 2016, Henry Vermaak wrote: On Tue, Feb 02, 2016 at 11:24:57AM +0100, Michael Van Canneyt wrote: On Tue, 2 Feb 2016, Henry Vermaak wrote: Pascal is not a language full of programmer traps, let's try not to add any! Well, see my

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Marcos Douglas
On Tue, Feb 2, 2016 at 7:49 AM, Michael Van Canneyt wrote: > It is not a statement, it is an expression. > > I prefer > x := iif Obj = nil then 0 else Obj.Value; > over > x := if Obj = nil then 0 else Obj.Value; > > Because it clearly differentiates between if (a statement) and iif (an > expre

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Serguei TARASSOV
On 02/02/2016 12:00, fpc-pascal-requ...@lists.freepascal.org wrote: On Tue, 2 Feb 2016, Michael Van Canneyt wrote: At least Firebird & Microsoft SQL Server and MS-Access contain it. FastReport uses it. I use this since 15+ years, I didn't make up this name myself:-) These products (remember Ex

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Serguei TARASSOV
On 02/02/2016 11:42, fpc-pascal-requ...@lists.freepascal.org wrote: On Tue, 2 Feb 2016, Sven Barth wrote: >No, the second is always better because safer. > >x := iif (Obj = nil, 0, Obj.Value); >This will raise access violation as a normal function or you depend on compiler implementation for thi

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Henry Vermaak wrote: On Tue, Feb 02, 2016 at 11:24:57AM +0100, Michael Van Canneyt wrote: On Tue, 2 Feb 2016, Henry Vermaak wrote: On Tue, Feb 02, 2016 at 10:49:03AM +0100, Michael Van Canneyt wrote: So the iif in either functional or expression form has my vote. I'm

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Mark Morgan Lloyd wrote: Michael Van Canneyt wrote: Call me old fashioned, but then I think foo:=iif(Condition1, iif(Condition2, ThenExpr1, ElseExpr1), iif(Condition3, ThenExpr2, ElseExpr2)); is more clear. The "if then" construct is really confus

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Henry Vermaak
On Tue, Feb 02, 2016 at 11:24:57AM +0100, Michael Van Canneyt wrote: > On Tue, 2 Feb 2016, Henry Vermaak wrote: > > >On Tue, Feb 02, 2016 at 10:49:03AM +0100, Michael Van Canneyt wrote: > >>So the iif in either functional or expression form has my vote. > > > >I'm surprised that you support iif in

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Sven Barth wrote: Am 02.02.2016 10:20 schrieb "Felipe Monteiro de Carvalho" < felipemonteiro.carva...@gmail.com>: If other people already use "iif" then maybe it is better to use the same name? Also I vaguely remember at least a few functions in existing code named IfT

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Mark Morgan Lloyd
Michael Van Canneyt wrote: Call me old fashioned, but then I think foo:=iif(Condition1, iif(Condition2, ThenExpr1, ElseExpr1), iif(Condition3, ThenExpr2, ElseExpr2)); is more clear. The "if then" construct is really confusing. "if then" is a statement, not an expression.

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Serguei TARASSOV
On 02/02/2016 11:30, fpc-pascal-requ...@lists.freepascal.org wrote: On Tue, 2 Feb 2016, Henry Vermaak wrote: >On Tue, Feb 02, 2016 at 10:49:03AM +0100, Michael Van Canneyt wrote: >>So the iif in either functional or expression form has my vote. > >I'm surprised that you support iif in functio

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 11:27 schrieb "Michael Van Canneyt" : > > > > On Tue, 2 Feb 2016, Serguei TARASSOV wrote: > >> On 02/02/2016 10:54, fpc-pascal-requ...@lists.freepascal.org wrote: >> >>> On Tue, 2 Feb 2016, Michael Van Canneyt wrote On Tue, 2 Feb 2016, Serguei TARASSOV wrote: > No, the

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 10:20 schrieb "Felipe Monteiro de Carvalho" < felipemonteiro.carva...@gmail.com>: > > If other people already use "iif" then maybe it is better to use the same name? > > Also I vaguely remember at least a few functions in existing code > named IfThen which would conflict with the new

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 11:12 schrieb "Serguei TARASSOV" : > > On 02/02/2016 10:54, fpc-pascal-requ...@lists.freepascal.org wrote: > >> On Tue, 2 Feb 2016, Michael Van Canneyt wrote >>> >>> >>> On Tue, 2 Feb 2016, Serguei TARASSOV wrote: > No, the second is always better because safer. >>> >>> > >>> >x := ii

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Mark Morgan Lloyd
Martin Schreiber wrote: And it could be extended to " V:= case i1 of 1: 'one'; 2: 'two'; else 'none'; end; I'm rather less happy with this because of the difficulty of inserting inline assertions etc. to catch unexpected values. -- Mark Morgan Lloyd markMLl .AT. telemetry

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 10:41 schrieb "Serguei TARASSOV" : > > On 02/02/2016 10:29, fpc-pascal-requ...@lists.freepascal.org wrote: >> >> 2016-02-01 10:59 GMT+01:00 Michael Schnell: >> Same here. I see no reason to differ from it. Introducing new >> incompatibility is bad idea. For me is good to have booth (O

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 10:38 schrieb "Marco van de Voort" : > > - I like &if ;) > > I don't see the point. And if a funky character is needed then use another > one, don't add a third overload to &. (statement to intrinsic instead of > statement to identifier and octal) He meant to use "if" as the name for

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Serguei TARASSOV wrote: On 02/02/2016 10:54, fpc-pascal-requ...@lists.freepascal.org wrote: On Tue, 2 Feb 2016, Michael Van Canneyt wrote On Tue, 2 Feb 2016, Serguei TARASSOV wrote: > No, the second is always better because safer. > >x := iif (Obj = nil, 0, Obj.Value)

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Michael Van Canneyt
On Tue, 2 Feb 2016, Henry Vermaak wrote: On Tue, Feb 02, 2016 at 10:49:03AM +0100, Michael Van Canneyt wrote: So the iif in either functional or expression form has my vote. I'm surprised that you support iif in function call form. Making something that looks like a function call but may n

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Sven Barth
Am 02.02.2016 08:34 schrieb "Anthony Walter" : > > Sven, > > I missed this post when you made it a two days ago. If someone hasn't already asked, does your implementation support short circuit evaluation? > > For example: > > BasketCount := IfThen(ShoppingList <> nil, ShoppingList.Count, 0); > > Wh

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Henry Vermaak
On Tue, Feb 02, 2016 at 10:49:03AM +0100, Michael Van Canneyt wrote: > So the iif in either functional or expression form has my vote. I'm surprised that you support iif in function call form. Making something that looks like a function call but may not behave as a function call (short cut eval)

  1   2   >