Hi,
I like when Free Pascal trying to implement best practices from other languages. That was with increment variable using assign operator: i += 1. Anyway, few days ago I analyzed C++ code and I liked one syntax:
if ( ( i = GetSomeValue ) >= 10 ) { // variable "i" already has value returned by GetSomeValue } I wonder if FPC has equivalent for this.
Regards _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
Am 08.01.2013 09:44, schrieb Krzysztof:
> I like when Free Pascal trying to implement best practices from other > languages. That was with increment variable using assign operator: i += 1. > Anyway, few days ago I analyzed C++ code and I liked one syntax: > > if ( ( i = GetSomeValue ) >= 10 ) { > // variable "i" already has value returned by GetSomeValue > } > > I wonder if FPC has equivalent for this. I hope not. Why do you use Pascal if you want this ugly C-crap-style? Even the i += 1 is a sin. *shudder* Michael _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
In reply to this post by Krzysztof
On Tue, Jan 8, 2013 at 10:44 AM, Krzysztof <[hidden email]> wrote:
> Hi, > > I like when Free Pascal trying to implement best practices from other > languages. That was with increment variable using assign operator: i += 1. > Anyway, few days ago I analyzed C++ code and I liked one syntax: > > if ( ( i = GetSomeValue ) >= 10 ) { > // variable "i" already has value returned by GetSomeValue > } > > I wonder if FPC has equivalent for this. No, and thanks Wirth for that, and for FPC/Delphi devs for not adding it up. It's one of the worst possible features ever existed in programming languages, and the cause for many bugs > > Regards > > _______________________________________________ > fpc-pascal maillist - [hidden email] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
In reply to this post by Krzysztof
On Tue, 8 Jan 2013 09:44:13 +0100
Krzysztof <[hidden email]> wrote: > Hi, > > I like when Free Pascal trying to implement best practices from other > languages. That was with increment variable using assign operator: i += 1. > Anyway, few days ago I analyzed C++ code and I liked one syntax: > > if ( ( i = GetSomeValue ) >= 10 ) { > // variable "i" already has value returned by GetSomeValue > } > > I wonder if FPC has equivalent for this. Even C has some equivalent: i = GetSomeValue; if ( i >= 10 ) { // no comment needed, the value of i is obvious } Mattias _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
I don't like a lot of C++ syntax but this one is interesting. You really don't like it? :)
_______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
In our previous episode, Krzysztof said:
> I don't like a lot of C++ syntax but this one is interesting. You really > don't like it? :) It's the worst thing ever. 95% of the hard to find errors in C in my code are due to = vs == mixup. _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
C programmers are (usually, but there are a lot of exceptions) bad
programmers who confuse the power of a language with the capability of decrease the ammount of typing needed to reach a certain goal. They despise pascal because pascal is somewhat verbose (ignoring that this is what makes pascal readable) because they think that the best language is the one wich allows to write a whole program in a single line of code. Thats because they dont usually think before writing, they think while they are implementing, and then the only thing between current momment and the momment when their program is "ready" is the ammount of typing. Pascal programmers tend to plan ahead, they think before they type. We type a lot because of Pascal verboseness, but usually our code is right from the start. We end up typing less because we fix less bugs. Pascal generally improves programmer productivity. Lets not break this by adding crazy ideas from C/C++ family of languages... 2013/1/8 Marco van de Voort <[hidden email]>: > In our previous episode, Krzysztof said: >> I don't like a lot of C++ syntax but this one is interesting. You really >> don't like it? :) > > It's the worst thing ever. 95% of the hard to find errors in C in my code > are due to = vs == mixup. > _______________________________________________ > fpc-pascal maillist - [hidden email] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
Administrator
|
In reply to this post by Krzysztof
> I don't like a lot of C++ syntax but this one is interesting. You really don't like it? :)
HELL NO! Most C/C++ programmers don't have any idea who will READ and CONTINUE their work, and I'm one of those unlucky person who has to deal with this stupid, error prone, unreadable, worthless "feature"! |
In reply to this post by Marco van de Voort
Marco van de Voort wrote:
> In our previous episode, Krzysztof said: >> I don't like a lot of C++ syntax but this one is interesting. You really >> don't like it? :) > > It's the worst thing ever. 95% of the hard to find errors in C in my code > are due to = vs == mixup. Seconded. In fact, if assignment didn't propagate a value like that I'm not sure a distinction would have to be made between (C-style) = and == or (Pascal-style) := and = -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
In reply to this post by Krzysztof
On Tue, Jan 08, 2013 at 09:58:19AM +0100, Krzysztof wrote:
> I don't like a lot of C++ syntax but this one is interesting. You really > don't like it? :) Most C programmers I've dealt with (including myself) consider this bad practise. Henry _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
In reply to this post by Jorge Aldo G. de F. Junior
On Tue, Jan 08, 2013 at 08:19:15AM -0300, Jorge Aldo G. de F. Junior wrote:
> C programmers are (usually, but there are a lot of exceptions) bad > programmers who confuse the power of a language with the capability of > decrease the ammount of typing needed to reach a certain goal. > > They despise pascal because pascal is somewhat verbose (ignoring that > this is what makes pascal readable) because they think that the best > language is the one wich allows to write a whole program in a single > line of code. > > Thats because they dont usually think before writing, they think while > they are implementing, and then the only thing between current momment > and the momment when their program is "ready" is the ammount of > typing. > > Pascal programmers tend to plan ahead, they think before they type. We > type a lot because of Pascal verboseness, but usually our code is > right from the start. We end up typing less because we fix less bugs. > > Pascal generally improves programmer productivity. Lets not break this > by adding crazy ideas from C/C++ family of languages... "Better to keep your mouth closed and be thought a fool than to open it and remove all doubt" _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
Your phrase almost made me care about...
Do you wanna make me care ? Show some points, make a constructive critic about what i said etc. For all that matter, your answer is just a plain old argumentum ad hominem, a fallacy category, and being a fallacy, tells me you cant really make a good answer, so i infer you are the idiot here. 2013/1/8 Henry Vermaak <[hidden email]>: > On Tue, Jan 08, 2013 at 08:19:15AM -0300, Jorge Aldo G. de F. Junior wrote: >> C programmers are (usually, but there are a lot of exceptions) bad >> programmers who confuse the power of a language with the capability of >> decrease the ammount of typing needed to reach a certain goal. >> >> They despise pascal because pascal is somewhat verbose (ignoring that >> this is what makes pascal readable) because they think that the best >> language is the one wich allows to write a whole program in a single >> line of code. >> >> Thats because they dont usually think before writing, they think while >> they are implementing, and then the only thing between current momment >> and the momment when their program is "ready" is the ammount of >> typing. >> >> Pascal programmers tend to plan ahead, they think before they type. We >> type a lot because of Pascal verboseness, but usually our code is >> right from the start. We end up typing less because we fix less bugs. >> >> Pascal generally improves programmer productivity. Lets not break this >> by adding crazy ideas from C/C++ family of languages... > > "Better to keep your mouth closed and be thought a fool than to open it > and remove all doubt" > _______________________________________________ > fpc-pascal maillist - [hidden email] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
On 09 Jan 2013, at 04:00, Jorge Aldo G. de F. Junior wrote: Your phrase almost made me care about... And that's enough for this little language war, thank you. Feature requests like this can certainly be discussed, but please do so without starting to insult programmers using other languages or each other. Thanks, Jonas FPC mailing lists admin _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
In reply to this post by Jorge Aldo G. de F. Junior
Jorge Aldo G. de F. Junior wrote:
> Your phrase almost made me care about... > > Do you wanna make me care ? Show some points, make a constructive > critic about what i said etc. > > For all that matter, your answer is just a plain old argumentum ad > hominem, a fallacy category, and being a fallacy, tells me you cant > really make a good answer, so i infer you are the idiot here. Please- that really wasn't called for. It's quite obvious from context that Henry was simply agreeing with your >>> Pascal generally improves programmer productivity. Lets not break this >>> by adding crazy ideas from C/C++ family of languages... >> "Better to keep your mouth closed and be thought a fool than to open it >> and remove all doubt" But if you want an example of a very nasty bug caused by C/C++ multiple assignment, there was a well-documented attempt to slip a privilege escalation into the Linux kernel based on this a few years ago. It's very easy to argue against multiple assignment. It's less easy to argue against implementing an equivalent of the C/C++ conditional. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
On Wed, Jan 09, 2013 at 08:42:22AM +0000, Mark Morgan Lloyd wrote:
> But if you want an example of a very nasty bug caused by C/C++ > multiple assignment, there was a well-documented attempt to slip a > privilege escalation into the Linux kernel based on this a few years > ago. > > It's very easy to argue against multiple assignment. It's less easy > to argue against implementing an equivalent of the C/C++ > conditional. Are you talking about this one? http://lwn.net/Articles/57135/ Henry _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
Henry Vermaak wrote:
> On Wed, Jan 09, 2013 at 08:42:22AM +0000, Mark Morgan Lloyd wrote: >> But if you want an example of a very nasty bug caused by C/C++ >> multiple assignment, there was a well-documented attempt to slip a >> privilege escalation into the Linux kernel based on this a few years >> ago. >> >> It's very easy to argue against multiple assignment. It's less easy >> to argue against implementing an equivalent of the C/C++ >> conditional. > > Are you talking about this one? > > http://lwn.net/Articles/57135/ Yes, although it took me a few minutes Googling after I posted the earlier comment before I had the reference to hand. I've got a vague recollection that since that episode the kernel maintainers have mandated a use of parentheses that helps the compiler pick up the distinction between an equality and an assignment. But it's unfortunate when programmers have to use a contrived form to work around sloppiness in the language design... I'm specifically talking about ill-conceived syntax here, not about flexibility that you get from easy access to things like pointer arithmetic. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
On Wed, Jan 09, 2013 at 10:46:54AM +0000, Mark Morgan Lloyd wrote:
> I've got a vague recollection that since that episode the kernel > maintainers have mandated a use of parentheses that helps the > compiler pick up the distinction between an equality and an Assignment inside if statements are usually frowned upon in the kernel. gcc warns if you don't use parentheses, but I usually use parentheses for readability, so there's always a danger of making a typo and not getting a warning. Can't remember the last time I've had a bug of this sort, but that's probably because I'm extra vigilant with conditionals. I think the decision to keep this syntax out of pascal is a good one. Henry _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
Henry Vermaak wrote:
> On Wed, Jan 09, 2013 at 10:46:54AM +0000, Mark Morgan Lloyd wrote: >> I've got a vague recollection that since that episode the kernel >> maintainers have mandated a use of parentheses that helps the >> compiler pick up the distinction between an equality and an > > Assignment inside if statements are usually frowned upon in the kernel. > gcc warns if you don't use parentheses, but I usually use parentheses > for readability, so there's always a danger of making a typo and not > getting a warning. Can't remember the last time I've had a bug of this > sort, but that's probably because I'm extra vigilant with conditionals. > I think the decision to keep this syntax out of pascal is a good one. I use C barely at all. In the words of one of the M2 vendors "We come to bury C, sir, not to praise it". If Pascal /had/ to have some sort of multiple assignment, I'd have thought borrowing an idea from Perl and doing something like [a, b, c] := (d = e); would have been minimally acceptable. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
In our previous episode, Mark Morgan Lloyd said:
> [a, b, c] := (d = e); > > would have been minimally acceptable. Did you really mean that or did you mean [a, b, c] := (d := e); ? :-) _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
Marco van de Voort wrote:
> In our previous episode, Mark Morgan Lloyd said: > >> [a, b, c] := (d = e); >> >> would have been minimally acceptable. > > Did you really mean that or did you mean > > [a, b, c] := (d := e); > > ? :-) :-) I meant what I wrote: a comparison on the right producing a Boolean which is assigned to three variables in a list. The parentheses were to try to make it a bit clearer, and I note that a Perl list is in parentheses rather than brackets. I'm not saying I like it, or that it's Pascal. But something like that would probably upset the fewest people that matter. Perhaps I should have said [a, b, c] += Ord(d = e); :-) -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] _______________________________________________ fpc-pascal maillist - [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
Free forum by Nabble | Edit this page |