Re: [fpc-devel] new features and facilities

2015-10-13 Thread Sven Barth
Am 13.10.2015 09:34 schrieb "Michael Van Canneyt" : > > > > On Mon, 12 Oct 2015, Marco van de Voort wrote: > >> In our previous episode, Michael Van Canneyt said: > > > I'm not sure this kind of semantics is possible with a compiler intrinsic... > > But if it is: In th

Re: [fpc-devel] new features and facilities

2015-10-13 Thread Michael Van Canneyt
On Mon, 12 Oct 2015, Marco van de Voort wrote: In our previous episode, Michael Van Canneyt said: I'm not sure this kind of semantics is possible with a compiler intrinsic... But if it is: In that case the IfThen or IIF() or somesuch has my absolute top preference, followed by ternary. (a

Re: [fpc-devel] new features and facilities

2015-10-12 Thread Sven Barth
Am 12.10.2015 23:29 schrieb "Marco van de Voort" : > > In our previous episode, Dmitry Boyarintsev said: > > On Mon, Oct 12, 2015 at 4:01 PM, Marco van de Voort wrote: > > > > > (ifthen clashes name with the delphi functions of the same name in a much > > > used unit as math, the name should be di

Re: [fpc-devel] new features and facilities

2015-10-12 Thread Marco van de Voort
In our previous episode, Dmitry Boyarintsev said: > On Mon, Oct 12, 2015 at 4:01 PM, Marco van de Voort wrote: > > > (ifthen clashes name with the delphi functions of the same name in a much > > used unit as math, the name should be different but the intrinsic principle > > IMHO is best) > > > Bu

Re: [fpc-devel] new features and facilities

2015-10-12 Thread Dmitry Boyarintsev
On Mon, Oct 12, 2015 at 4:01 PM, Marco van de Voort wrote: > (ifthen clashes name with the delphi functions of the same name in a much > used unit as math, the name should be different but the intrinsic principle > IMHO is best) > But they're inline functions. Thus when inline-d into the code, th

Re: [fpc-devel] new features and facilities

2015-10-12 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > >> > >> I'm not sure this kind of semantics is possible with a compiler > > intrinsic... > >> But if it is: In that case the IfThen or IIF() or somesuch has my > > absolute top preference, followed by ternary. (and the If .. then > > expression s

Re: [fpc-devel] new features and facilities

2015-10-12 Thread Marco van de Voort
In our previous episode, Dmitry Boyarintsev said: > The only Pascal way is > > left := IfThen(expr1, expr2, expr3) I also think intrinsic pseudo function syntax would be best, evaluating only one expression. Because that is the primary purpose of the ternary. Making it an operator is just C cop

Re: [fpc-devel] new features and facilities

2015-10-11 Thread Jonas Maebe
On 11/10/15 14:22, MohsenTi wrote: I added more info needed by compiler ,but I don't know what is executionweight in pass_generate_code function of tcgwhilerepeatnode class The executionweight is used to determine how often a particular node will be executed. The higher the value, more often i

Re: [fpc-devel] new features and facilities

2015-10-11 Thread MohsenTi
Hi I added new keyword to moderate while - else (otherwise) new codes is Ex1: while( I>5 ) do begin Dec(I); write(I); end otherwise write(' otherwise while '); Ex2: if (I<10) then while( I>5 ) do begin Dec(I); write(I); end otherwise write(' otherwise while ') else write(' IF ELSE '); I need

Re: [fpc-devel] new features and facilities

2015-10-10 Thread wkitty42
On 10/10/2015 07:12 AM, Mark Morgan Lloyd wrote: One thing that bothers me about these approaches is that sooner or later some awkward cuss (such as myself) will start whining about how much better Pascal would be if there were a decent macro preprocessor so that CaseOf() could be specialised int

Re: [fpc-devel] new features and facilities

2015-10-10 Thread Mark Morgan Lloyd
Michael Van Canneyt wrote: On Sat, 10 Oct 2015, Sven Barth wrote: Am 10.10.2015 10:51 schrieb "Mark Morgan Lloyd" < markmll.fpc-de...@telemetry.co.uk>: Michael Van Canneyt wrote: On Fri, 9 Oct 2015, Sven Barth wrote: I'm not sure this kind of semantics is possible with a compiler intr

Re: [fpc-devel] new features and facilities

2015-10-10 Thread Michael Van Canneyt
On Sat, 10 Oct 2015, Sven Barth wrote: Am 10.10.2015 10:51 schrieb "Mark Morgan Lloyd" < markmll.fpc-de...@telemetry.co.uk>: Michael Van Canneyt wrote: On Fri, 9 Oct 2015, Sven Barth wrote: I'm not sure this kind of semantics is possible with a compiler intrinsic... But if it is: I

Re: [fpc-devel] new features and facilities

2015-10-10 Thread Sven Barth
Am 10.10.2015 10:51 schrieb "Mark Morgan Lloyd" < markmll.fpc-de...@telemetry.co.uk>: > > Michael Van Canneyt wrote: >> >> On Fri, 9 Oct 2015, Sven Barth wrote: >> >> I'm not sure this kind of semantics is possible with a compiler >>> >>> intrinsic... But if it is: In that case

Re: [fpc-devel] new features and facilities

2015-10-10 Thread Mark Morgan Lloyd
Michael Van Canneyt wrote: On Fri, 9 Oct 2015, Sven Barth wrote: I'm not sure this kind of semantics is possible with a compiler intrinsic... But if it is: In that case the IfThen or IIF() or somesuch has my absolute top preference, followed by ternary. (and the If .. then expression shoul

Re: [fpc-devel] new features and facilities

2015-10-10 Thread Sven Barth
Am 09.10.2015 23:11 schrieb "Dmitry Boyarintsev" : > > On Fri, Oct 9, 2015 at 5:04 PM, Sven Barth wrote: >> >> Yes a compiler intrinsic could handle that. In the end all three syntaxes are the same code representation anyway: namely an if-node. >> The IfThen() intrinsic would be fine with me as we

Re: [fpc-devel] new features and facilities

2015-10-09 Thread Michael Van Canneyt
On Fri, 9 Oct 2015, Sven Barth wrote: I'm not sure this kind of semantics is possible with a compiler intrinsic... But if it is: In that case the IfThen or IIF() or somesuch has my absolute top preference, followed by ternary. (and the If .. then expression should be blasted to hell ;) )

Re: [fpc-devel] new features and facilities

2015-10-09 Thread Dmitry Boyarintsev
On Fri, Oct 9, 2015 at 5:04 PM, Sven Barth wrote: > Yes a compiler intrinsic could handle that. In the end all three syntaxes > are the same code representation anyway: namely an if-node. > The IfThen() intrinsic would be fine with me as well. Let's call this our > common ground ;) > I wonder if

Re: [fpc-devel] new features and facilities

2015-10-09 Thread Sven Barth
Am 08.10.2015 19:51 schrieb "MohsenTi" : > > Thank you Sven, > is there any documentation about freepascal compiler parts ? Nope, sorry. It's mainly learning by doing or maybe learning by debugging... Regards, Sven ___ fpc-devel maillist - fpc-devel@l

Re: [fpc-devel] new features and facilities

2015-10-09 Thread Sven Barth
Am 09.10.2015 20:29 schrieb "Michael Van Canneyt" : > > > > On Fri, 9 Oct 2015, Dmitry Boyarintsev wrote: > >> The only Pascal way is >> >> left := IfThen(expr1, expr2, expr3) >> >> Similar to addr(), sizeof(), length(), write() and recently added Default() >> in intrinsic. >> I guess functions dec

Re: [fpc-devel] new features and facilities

2015-10-09 Thread Dmitry Boyarintsev
On Fri, Oct 9, 2015 at 2:45 PM, Dmitry Boyarintsev < skalogryz.li...@gmail.com> wrote: > Looking at the assembler code, a=0 is evaluated first. > If it's true, the code is passed to the next line after assert, w/o > evaluating 'error '+intToStr(b). > And that's the reason why assert() was invente

Re: [fpc-devel] new features and facilities

2015-10-09 Thread Dmitry Boyarintsev
On Fri, Oct 9, 2015 at 2:30 PM, Michael Van Canneyt wrote: I'm not sure this kind of semantics is possible with a compiler intrinsic... > But if it is: In that case the IfThen or IIF() or somesuch has my absolute > top preference, followed by ternary. (and the If .. then expression should > be bl

Re: [fpc-devel] new features and facilities

2015-10-09 Thread Michael Van Canneyt
On Fri, 9 Oct 2015, Dmitry Boyarintsev wrote: The only Pascal way is left := IfThen(expr1, expr2, expr3) Similar to addr(), sizeof(), length(), write() and recently added Default() in intrinsic. I guess functions declared in Math unit are not covering all the needs (since type of expr2, expr

Re: [fpc-devel] new features and facilities

2015-10-09 Thread Dmitry Boyarintsev
The only Pascal way is left := IfThen(expr1, expr2, expr3) Similar to addr(), sizeof(), length(), write() and recently added Default() in intrinsic. I guess functions declared in Math unit are not covering all the needs (since type of expr2, expr3) may vary. That's why a bit of compiler support

Re: [fpc-devel] new features and facilities

2015-10-09 Thread Sven Barth
Am 09.10.2015 08:36 schrieb "Michael Van Canneyt" : >> There also another reason why I prefer the variant with the if: ease to >> implement in the compiler. >> >> For the if one merely needs to add a corresponding case in factor() while >> for the ?: one needs to fiddle with the compiler's operato

Re: [fpc-devel] new features and facilities

2015-10-09 Thread Mark Morgan Lloyd
Michael Van Canneyt wrote: On Fri, 9 Oct 2015, Sven Barth wrote: Am 08.10.2015 23:48 schrieb "Michael Van Canneyt" : Actually, yes I think C's or Javascript's ternary is better suited. Let me explain. If I see If expr1 then expr2 else expr3 it says 'statement' to me. But a ? b : c; Says "

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Michael Van Canneyt
On Fri, 9 Oct 2015, Sven Barth wrote: Am 08.10.2015 23:48 schrieb "Michael Van Canneyt" : Actually, yes I think C's or Javascript's ternary is better suited. Let me explain. If I see If expr1 then expr2 else expr3 it says 'statement' to me. But a ? b : c; Says "expression" to me. So le

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Sven Barth
Am 08.10.2015 23:48 schrieb "Michael Van Canneyt" : > Actually, yes I think C's or Javascript's ternary is better suited. > > Let me explain. If I see > > If expr1 then expr2 else expr3 > > it says 'statement' to me. But > > a ? b : c; > > Says "expression" to me. > > So > > left := a ? b : c; Tha

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Martin Frb
On 08/10/2015 23:18, Mark Morgan Lloyd wrote: Michael Van Canneyt wrote: Let me explain. If I see If expr1 then expr2 else expr3 it says 'statement' to me. But a ? b : c; Says "expression" to me. The way I look at it is that it's restoring a feature that was (possibly accidentally) droppe

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Michael Van Canneyt
On Thu, 8 Oct 2015, Mark Morgan Lloyd wrote: Michael Van Canneyt wrote: On Thu, 8 Oct 2015, Sven Barth wrote: Am 08.10.2015 19:10 schrieb "Ralf Quint" : On 10/8/2015 9:54 AM, Sven Barth wrote: I had the idea to implement inline-if as well. I think the syntax I selected is derived from

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Mark Morgan Lloyd
Michael Van Canneyt wrote: On Thu, 8 Oct 2015, Sven Barth wrote: Am 08.10.2015 19:10 schrieb "Ralf Quint" : On 10/8/2015 9:54 AM, Sven Barth wrote: I had the idea to implement inline-if as well. I think the syntax I selected is derived from Oxygene, but it looks very Pascal and shouldn't

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Michael Van Canneyt
On Thu, 8 Oct 2015, Sven Barth wrote: Am 08.10.2015 19:10 schrieb "Ralf Quint" : On 10/8/2015 9:54 AM, Sven Barth wrote: I had the idea to implement inline-if as well. I think the syntax I selected is derived from Oxygene, but it looks very Pascal and shouldn't break anything: left :=

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Ralf Quint
On 10/8/2015 2:07 PM, Sven Barth wrote: And you think C's ternary would be more Pascal? Well, no. While I use the ternary operator quite a bit when using C, as it IMHO allows for a cleaner formatting of code there, in Pascal, I always use a cleanly formatted If-then-else. Ralf --- This ema

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Sven Barth
Am 08.10.2015 19:10 schrieb "Ralf Quint" : > > On 10/8/2015 9:54 AM, Sven Barth wrote: >> >> >> I had the idea to implement inline-if as well. I think the syntax I selected is derived from Oxygene, but it looks very Pascal and shouldn't break anything: >> >> left := if expr1 then expr2 else expr3;

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Mark Morgan Lloyd
Ralf Quint wrote: On 10/8/2015 9:54 AM, Sven Barth wrote: I had the idea to implement inline-if as well. I think the syntax I selected is derived from Oxygene, but it looks very Pascal and shouldn't break anything: left := if expr1 then expr2 else expr3; Thereby expr1 returns Boolean and e

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Carlo Kok
Op 2015-10-08 om 19:25 schreef Dmitry Boyarintsev: On Thu, Oct 8, 2015 at 12:54 PM, Sven Barth mailto:pascaldra...@googlemail.com>> wrote: I had the idea to implement inline-if as well. I think the syntax I selected is derived from Oxygene, but it looks very Pascal and shouldn't br

Re: [fpc-devel] new features and facilities

2015-10-08 Thread MohsenTi
Thank you Sven, is there any documentation about freepascal compiler parts ? On Thu, Oct 8, 2015 at 8:27 PM, Sven Barth wrote: > Am 08.10.2015 17:37 schrieb "MohsenTi" : > > > > I know this issue but with changing some of structures, I can implement > it and now I only want testing adding featur

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Ralf Quint
On 10/8/2015 10:35 AM, Mark Morgan Lloyd wrote: Indeed, it is even more succinct in C/C++: x = ? : ; At which point you'll have various members of the Pascal community decrying it as too C-like. Well, the tenary operator as present in C(++) is a shortcut for a simple if-then-else, a

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Mark Morgan Lloyd
David W Noon wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 08 Oct 2015 16:12:56 +, Mark Morgan Lloyd (markmll.fpc-de...@telemetry.co.uk) wrote about "Re: [fpc-devel] new features and facilities" (in ): Ondrej Pokorny wrote: As Michael has said, adding an extra

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Dmitry Boyarintsev
On Thu, Oct 8, 2015 at 12:54 PM, Sven Barth wrote: > I had the idea to implement inline-if as well. I think the syntax I > selected is derived from Oxygene, but it looks very Pascal and shouldn't > break anything: > > left := if expr1 then expr2 else expr3; > > Thereby expr1 returns Boolean and e

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Ralf Quint
On 10/8/2015 9:54 AM, Sven Barth wrote: I had the idea to implement inline-if as well. I think the syntax I selected is derived from Oxygene, but it looks very Pascal and shouldn't break anything: left := if expr1 then expr2 else expr3; Thereby expr1 returns Boolean and expr2 determines the

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Ondrej Pokorny
On 08.10.2015 18:54, Sven Barth wrote: I had the idea to implement inline-if as well. I think the syntax I selected is derived from Oxygene, but it looks very Pascal and shouldn't break anything: left := if expr1 then expr2 else expr3; Thereby expr1 returns Boolean and expr2 determines the ty

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Sven Barth
Am 08.10.2015 17:37 schrieb "MohsenTi" : > > I know this issue but with changing some of structures, I can implement it and now I only want testing adding features to compiler and don't care about backward compatibility,just testing. I wouldn't integrate it in the compiler, but for playing around

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Sven Barth
Am 08.10.2015 17:43 schrieb "Ondrej Pokorny" : > > On 08.10.2015 17:37, MohsenTi wrote: >> >> I know this issue but with changing some of structures, I can implement it and now I only want testing adding features to compiler and don't care about backward compatibility,just testing. >> >> I added so

Re: [fpc-devel] new features and facilities

2015-10-08 Thread David W Noon
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 08 Oct 2015 16:12:56 +, Mark Morgan Lloyd (markmll.fpc-de...@telemetry.co.uk) wrote about "Re: [fpc-devel] new features and facilities" (in ): > Ondrej Pokorny wrote: > > As Michael has said, adding an extra else

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Mark Morgan Lloyd
Ondrej Pokorny wrote: As Michael has said, adding an extra else or for that matter otherwise would be a problem. And what about the inline if? That should be backwards compatible at a first glance. And it would be a fun thing because the Delphi community has asked for it for many years an

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Ondrej Pokorny
On 08.10.2015 17:37, MohsenTi wrote: I know this issue but with changing some of structures, I can implement it and now I only want testing adding features to compiler and don't care about backward compatibility,just testing. I added some changes to compiler functions and classes like pstatmn

Re: [fpc-devel] new features and facilities

2015-10-08 Thread MohsenTi
I know this issue but with changing some of structures, I can implement it and now I only want testing adding features to compiler and don't care about backward compatibility,just testing. I added some changes to compiler functions and classes like pstatmnt.while_statement and nflw.twhilerepeatnod

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Paul Michell
I'm in tomorrow, we can take a look then. Kind regards, Paul On 08/10/15 14:33, Mohsen wrote: Hi! I wanna add new features and facilities to pascal like while - else, for - else and inline if statement like python. examples ex1: I:=5; while(I>0) do begin Write(I); I:=I-1; en

Re: [fpc-devel] new features and facilities

2015-10-08 Thread Michael Van Canneyt
On Thu, 8 Oct 2015, Mohsen wrote: Hi! I wanna add new features and facilities to pascal like while - else, for - else and inline if statement like python. examples ex1: I:=5; while(I>0) do begin Write(I); I:=I-1; end else Write(' While Else '); This cannot be implemented withou