Re: [fpc-devel] Fwd: While - Otherwise Statement
Sven Barth wrote: The intrafunctional gotos not really. But the interfunctional ones (modeswitch nonlocalgoto in 2.7.1+) might mess with managed types ;) The compiler should give an error if you try to "goto" out of or into a frame than needs initialisation/finalisation. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
On Mon, 12 Oct 2015, wkitt...@windstream.net wrote: On 10/12/2015 03:43 PM, Martin Frb wrote: Actually the above does not represent what the actual feature request is about The "else" is to be executed, after the while (even if the while looped ZERO times). But it is to be skipped if the while exited via break (and only then). For that reason "else" or "otherwise" are badly chosen keywords. Because they imply a different function. exactly my and others' points... "and" would be better but then one might just as easily use a goto to jump around that part if break was used to get out of the loop... anyway, it seems that no matter what the discussion, it won't make it into the compiler... that according to another post from a compiler dev ;) Maybe my remark was not clear. I'm not against this *functionality*. I merely pointed out that *the syntax using 'else'* is not going to make it because it breaks backwards compatibility. If another keyword is used: no problem. I don't understand why anyone would want this marginal functionality and thus (again) needlessly complicates the language, but hey, it's a (mostly) free world Alas, the monstrosity that Object Pascal syntax is becoming is less and less appealing by the day, it's simply frightening... Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] new features and facilities
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. (and the If .. then expression should be blasted to hell ;) ) 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 ;) Agreed ! (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) IIF ? Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] new features and facilities
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 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 ;) ) 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 ;) >>> >>> >>> Agreed ! >> >> >> (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) > > > IIF ? As someone else already wrote name clashes shouldn't be a problem as Math is always used after System and thus Math.IfThen takes precedence. Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
Am 13.10.2015 08:36 schrieb "Jonas Maebe": > > Sven Barth wrote: >> >> The intrafunctional gotos not really. But the interfunctional ones >> (modeswitch nonlocalgoto in 2.7.1+) might mess with managed types ;) > > > The compiler should give an error if you try to "goto" out of or into a frame than needs initialisation/finalisation. Ah, ok, so we're already checking that. Good ^^ Then it's mostly the "bad karma" of goto I'd say ;) Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
wkitt...@windstream.net wrote: On 10/13/2015 04:32 AM, Michael Van Canneyt wrote: On Mon, 12 Oct 2015, wkitt...@windstream.net wrote: On 10/12/2015 03:43 PM, Martin Frb wrote: Actually the above does not represent what the actual feature request is about The "else" is to be executed, after the while (even if the while looped ZERO times). But it is to be skipped if the while exited via break (and only then). For that reason "else" or "otherwise" are badly chosen keywords. Because they imply a different function. exactly my and others' points... "and" would be better but then one might just as easily use a goto to jump around that part if break was used to get out of the loop... anyway, it seems that no matter what the discussion, it won't make it into the compiler... that according to another post from a compiler dev ;) Maybe my remark was not clear. I'm not against this *functionality*. I merely pointed out that *the syntax using 'else'* is not going to make it because it breaks backwards compatibility. a... my bad... sorry 'bout that... i've been thinking about this, too... 'else' and 'otherwise' mean the same thing... what they seem to be looking for is 'aswell'... foo := 0; while foo < 100 do begin inc(foo); end; aswell begin dec(foo); end; either 'aswell' or 'aswellas'... while foo is less than 100 increment foo as well as decrement foo when it is no longer less than 100... If somebody really has to do this wouldn't "also" be a better choice to avoid (getting close to overloading "as"? :-/ -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
On 10/13/2015 04:32 AM, Michael Van Canneyt wrote: On Mon, 12 Oct 2015, wkitt...@windstream.net wrote: On 10/12/2015 03:43 PM, Martin Frb wrote: Actually the above does not represent what the actual feature request is about The "else" is to be executed, after the while (even if the while looped ZERO times). But it is to be skipped if the while exited via break (and only then). For that reason "else" or "otherwise" are badly chosen keywords. Because they imply a different function. exactly my and others' points... "and" would be better but then one might just as easily use a goto to jump around that part if break was used to get out of the loop... anyway, it seems that no matter what the discussion, it won't make it into the compiler... that according to another post from a compiler dev ;) Maybe my remark was not clear. I'm not against this *functionality*. I merely pointed out that *the syntax using 'else'* is not going to make it because it breaks backwards compatibility. a... my bad... sorry 'bout that... i've been thinking about this, too... 'else' and 'otherwise' mean the same thing... what they seem to be looking for is 'aswell'... foo := 0; while foo < 100 do begin inc(foo); end; aswell begin dec(foo); end; either 'aswell' or 'aswellas'... while foo is less than 100 increment foo as well as decrement foo when it is no longer less than 100... i don't see a need for it because in this case if one wants foo to only get to 99, then they should use 99 as their count... foo := 0; while foo < 99 do begin inc(foo); end; at the end of the loop, foo will equal 99... but it is also a very simple example... If another keyword is used: no problem. ok... I don't understand why anyone would want this marginal functionality and thus (again) needlessly complicates the language, but hey, it's a (mostly) free world Alas, the monstrosity that Object Pascal syntax is becoming is less and less appealing by the day, it's simply frightening... it seems that way... but it doesn't mean that we have to use it... we can stay with the traditional ways and means within whatever it becomes as long as they don't change with these undesirable extensions... -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, 12 Oct 2015 22:34:03 -0300, Flávio Etrusco (flavio.etru...@gmail.com) wrote about "Re: [fpc-devel] Fwd: While - Otherwise Statement" (in
Re: [fpc-devel] Fwd: While - Otherwise Statement
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, 12 Oct 2015 21:32:07 -0400, Wkitty42 (wkitt...@windstream.net) wrote about "Re: [fpc-devel] Fwd: While - Otherwise Statement" (in <561c5f17.4070...@windstream.net>): [snip] > that looks very much like what some would consider goto > statements... does the leave return to the top of the previous loop > or does it drop to the next statement in the previous loop? It leaves the loop at the END statement that matches the DO statement as labelled. So it goes to the next statement in the surrounding loop. >> If the label is omitted then the immediately containing loop is >> left. > > "immediately containing loop" meaning loop_3 if we're in loop_3? Correct. It's the same as break. > yup! and i did catch the THEH->THEN oops... no problems there O:) Ageing eyes, I'm afraid. When I remove my contact lenses at night I have very distorted corneas (keratoconus) and cannot easily distinguish an H from an N. ... :-( - -- Regards, Dave [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* david.w.n...@googlemail.com (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -BEGIN PGP SIGNATURE- Version: GnuPG v2 iEYEARECAAYFAlYdJV4ACgkQogYgcI4W/5QZKgCaA7lhDyhW/D0E+ATdBhrkzyIM YrsAmwYelE+svkFxHDZvKLP3AJ/HZ8DN =WNCc -END PGP SIGNATURE- ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
On 10/13/2015 1:32 AM, Michael Van Canneyt wrote: I don't understand why anyone would want this marginal functionality and thus (again) needlessly complicates the language, but hey, it's a (mostly) free world Alas, the monstrosity that Object Pascal syntax is becoming is less and less appealing by the day, it's simply frightening... +1 Ralf --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
On 10/13/2015 09:40 AM, Mark Morgan Lloyd wrote: wkitt...@windstream.net wrote: a... my bad... sorry 'bout that... i've been thinking about this, too... 'else' and 'otherwise' mean the same thing... what they seem to be looking for is 'aswell'... foo := 0; while foo < 100 do begin inc(foo); end; aswell begin dec(foo); end; either 'aswell' or 'aswellas'... while foo is less than 100 increment foo as well as decrement foo when it is no longer less than 100... If somebody really has to do this wouldn't "also" be a better choice to avoid (getting close to overloading "as"? :-/ it might... i don't know anything about "as" because i've never used it... what does it do? -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] adding a new token to compiler cause exception
On 13/10/15 19:59, Mohsen wrote: if (idtoken in [_EXPORT,_EXTERNAL,_WEAKEXTERNAL,_PUBLIC,_CVAR]) then ptconst.pas(95,45) Error: range check error in set constructor or duplicate set element how to solve it ? Pascal sets can only contain values/enumerations whose ordinal value is <= 255. There are more than 256 tokens already. If you add new tokens at the start, existing tokens may get an ordinal value > 255, so existing set expressions that previously worked may now fail. The only way to solve that is to remove the items whose ordinal values are > 255 from set expressions and to test for them using the regular '=' operator. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
wkitt...@windstream.net wrote: a... my bad... sorry 'bout that... i've been thinking about this, too... 'else' and 'otherwise' mean the same thing... what they seem to be looking for is 'aswell'... foo := 0; while foo < 100 do begin inc(foo); end; aswell begin dec(foo); end; either 'aswell' or 'aswellas'... while foo is less than 100 increment foo as well as decrement foo when it is no longer less than 100... I am not native English, but aswell to me implies "do both" and gives no order. So I would expect this (the aswell block) to be executed for each iteration too. like the perl continue block http://perldoc.perl.org/functions/continue.html btw, while I am not for it, the continue block appears much more useful than the "on-none-break" block. Though the continue block is not really ever needed, usually you can write the loop with the counter decrement at the top. But the existence of such a continue block shows the fundamental issue on which a decision is needed. should (if a volunteer for a patch exists) every little "save one statement in your code helper" be added? Because there are thousands of them, and if you add them all the readability of code will go down, because you need to first learn them all. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] adding a new token to compiler cause exception
I want to add two overloadable operators “>>” and “<<” to use them as “shr” and “shl” ,or writing into and reading from streams and the other functions like those mentioned above. در تاریخ ۱۳ اکتبر ۲۰۱۵ ۲۲:۲۱، "Sven Barth"نوشت: > Am 13.10.2015 19:59 schrieb "Mohsen" : > > > > Hi > > I need add two token to compiler to implement my ideas. > > adding first token done but second token cause range check exception in > lines like this > > > > if (idtoken in [_EXPORT,_EXTERNAL,_WEAKEXTERNAL,_PUBLIC,_CVAR]) then > > > > ptconst.pas(95,45) Error: range check error in set constructor or > duplicate set element > > > > how to solve it ? > > First it would be best if you'd show us what exactly you have changed. > Otherwise we won't be able to help you... > > Regards, > Sven > > ___ > fpc-devel maillist - fpc-devel@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] adding a new token to compiler cause exception
Hi I need add two token to compiler to implement my ideas. adding first token done but second token cause range check exception in lines like this if (idtoken in [_EXPORT,_EXTERNAL,_WEAKEXTERNAL,_PUBLIC,_CVAR]) then ptconst.pas(95,45) Error: range check error in set constructor or duplicate set element how to solve it ? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
Am 13.10.2015 19:21 schrieb: >> >> If somebody really has to do this wouldn't "also" be a better choice to avoid >> (getting close to overloading "as"? :-/ > > > it might... i don't know anything about "as" because i've never used it... what does it do? It's an operator for casting classes and interfaces in a safe way (which means that an exception is raised if the cast fails). See here: http://www.freepascal.org/docs-html/ref/refsu47.html#x141-15100012.8.7 Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] adding a new token to compiler cause exception
Am 13.10.2015 19:59 schrieb "Mohsen": > > Hi > I need add two token to compiler to implement my ideas. > adding first token done but second token cause range check exception in lines like this > > if (idtoken in [_EXPORT,_EXTERNAL,_WEAKEXTERNAL,_PUBLIC,_CVAR]) then > > ptconst.pas(95,45) Error: range check error in set constructor or duplicate set element > > how to solve it ? First it would be best if you'd show us what exactly you have changed. Otherwise we won't be able to help you... Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
On Tue, 13 Oct 2015, Martin Frb wrote: wkitt...@windstream.net wrote: a... my bad... sorry 'bout that... i've been thinking about this, too... 'else' and 'otherwise' mean the same thing... what they seem to be looking for is 'aswell'... foo := 0; while foo < 100 do begin inc(foo); end; aswell begin dec(foo); end; either 'aswell' or 'aswellas'... while foo is less than 100 increment foo as well as decrement foo when it is no longer less than 100... I am not native English, but aswell to me implies "do both" and gives no order. So I would expect this (the aswell block) to be executed for each iteration too. like the perl continue block http://perldoc.perl.org/functions/continue.html btw, while I am not for it, the continue block appears much more useful than the "on-none-break" block. Though the continue block is not really ever needed, usually you can write the loop with the counter decrement at the top. But the existence of such a continue block shows the fundamental issue on which a decision is needed. should (if a volunteer for a patch exists) every little "save one statement in your code helper" be added? Because there are thousands of them, and if you add them all the readability of code will go down, because you need to first learn them all. I think the answer to your question is a clear and loud "NO". The argument that we can refrain from using these new features does not hold, because other people will be using it, and we will have to know all of it to be able to understand their code. None of these features will automagically make Object Pascal a popular language. However, I seem to be one of the very few thinking this given the enthousiasm with which people are discussing this. Soon I will be forced to emigrate to Javascript country. Despite all its drawbacks, it remains at least a simple language. a dozen keywords and you're done. No wonder Node.js is so popular. Compare that with the jungle we're making of it... :( Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] adding a new token to compiler cause exception
Am 13.10.2015 21:51 schrieb "Jonas Maebe": > > On 13/10/15 19:59, Mohsen wrote: >> >> if (idtoken in [_EXPORT,_EXTERNAL,_WEAKEXTERNAL,_PUBLIC,_CVAR]) then >> >> ptconst.pas(95,45) Error: range check error in set constructor or >> duplicate set element >> >> how to solve it ? > > > Pascal sets can only contain values/enumerations whose ordinal value is <= 255. There are more than 256 tokens already. If you add new tokens at the start, existing tokens may get an ordinal value > 255, so existing set expressions that previously worked may now fail. > > The only way to solve that is to remove the items whose ordinal values are > 255 from set expressions and to test for them using the regular '=' operator. Maybe I should start to work on the support for array constructors and operators once generic functions and dynamic packages are working... :P Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
On Tue, Oct 13, 2015 at 5:25 PM, Michael Van Canneytwrote: > However, I seem to be one of the very few thinking this given the > enthousiasm with which people are discussing this. > Even Niklaus Wirth regrets about bloating languages: https://www.youtube.com/watch?v=BJIqHIYSDrk thanks, Dmitry ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fwd: While - Otherwise Statement
On Tue, 13 Oct 2015 23:25:03 +0200 (CEST) Michael Van Canneytwrote: >[...] > The argument that we can refrain from using these new features does not hold, > because other people will be using it, and we will have to know all of it to > be able to understand their code. And it costs precious time of documentation and tool writers, who are already lacking behind. And every new feature makes the compiler a bit slower, costing time of all users. Each new feature must present a solid case, why it is needed aka outweighs the downside. > None of these features will automagically make Object Pascal a popular > language. > > However, I seem to be one of the very few thinking this given the enthousiasm > with > which people are discussing this. Are you kidding? Some people are already forking FPC because of such things. > Soon I will be forced to emigrate to Javascript country. > Despite all its drawbacks, it remains at least a simple language. > a dozen keywords and you're done. No wonder Node.js is so popular. > Compare that with the jungle we're making of it... :( Well, then you should vote against this new functionality. Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] new features and facilities
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 different but the intrinsic principle > > > IMHO is best) > > > > > But they're inline functions. Thus when inline-d into the code, they're > > acting as intrinsic. > > Are they? It sounds dangerous to me that inlining would suddenly not > evaluate functions anymore. It's should not be the case with functions, but with the right optimization settings the compiler might optimize away statements/expressions that otherwise would have generated exceptions. Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel