Lars Fosdal 1793 Posted August 19, 2021 I like clarity. Brevity is not always clarity. Share this post Link to post
Stefan Glienke 2015 Posted August 19, 2021 IMO the only true way to do this in pascal is as they done in Oxygene - see "if expressions": https://docs.elementscompiler.com/Oxygene/Delphi/NewFeatures/ 3 Share this post Link to post
Lars Fosdal 1793 Posted August 19, 2021 The If and Case statements expressions are indeed pretty nice. Share this post Link to post
0x8000FFFF 22 Posted August 19, 2021 3 hours ago, Lars Fosdal said: The If and Case statements are indeed pretty nice. We already have if and case statements in Delphi, we don't have expressions though. Expressions are parts of statements. Speaking of Oxygene, don't forget to mention colon operator, lambda expressions, for loop expressions, async & await (.NET only) expressions and more ... See also this Q&A that relates to the topic discussed in this thread - ternary conditional operator, null-coalescing operator (Elvis operator) and Oxygene colon operator: Escape from chain of Assigned() in Delphi It also provides some QP links of feature requests. 1 Share this post Link to post
Kazantsev Alexey 24 Posted September 18, 2021 https://quality.embarcadero.com/browse/RSP-35397 Share this post Link to post
Joseph MItzen 251 Posted September 18, 2021 On 8/13/2021 at 3:38 AM, dummzeuch said: I wouldn't refactor code only to now use inline variable declarations either. Why not? Share this post Link to post
dummzeuch 1512 Posted September 18, 2021 23 minutes ago, Joseph MItzen said: Why not? Because I'm not Barney Stinson. 2 Share this post Link to post
Joseph MItzen 251 Posted September 18, 2021 (edited) <Deleted> Edited September 18, 2021 by Joseph MItzen I'm stupid Share this post Link to post
Joseph MItzen 251 Posted September 18, 2021 On 8/19/2021 at 6:07 AM, Stefan Glienke said: IMO the only true way to do this in pascal is as they done in Oxygene - see "if expressions": https://docs.elementscompiler.com/Oxygene/Delphi/NewFeatures/ IMHO the only true way to do this in pascal is as they've done in Python... like Oxygene, except Oxygene reversed it for for some reason. ilabel = 'Item' if ilist.Count == 1 else 'Items' Share this post Link to post
uligerhardt 18 Posted September 18, 2021 48 minutes ago, Joseph MItzen said: IMHO the only true way to do this in pascal is as they've done in Python... like Oxygene, except Oxygene reversed it for for some reason. ilabel = 'Item' if ilist.Count == 1 else 'Items' If I'm not missing anything, Oxygene didn't "reverse" it, but kept it consistent with Pascal. Share this post Link to post
David Heffernan 2352 Posted September 18, 2021 22 minutes ago, uligerhardt said: If I'm not missing anything, Oxygene didn't "reverse" it, but kept it consistent with Pascal. I don't think that rings true. I mean the Python if statement is the same as the Pascal if statement. The Python syntax is closer to natural language than what is done in Oxygene. I don't see either as being particularly in keeping with Pascal, one way or another. Share this post Link to post
dummzeuch 1512 Posted September 19, 2021 10 hours ago, Joseph MItzen said: IMHO the only true way to do this in pascal is as they've done in Python... ilabel = 'Item' if ilist.Count == 1 else 'Items' Looks like Perl to me, only with less special characters. Share this post Link to post
David Heffernan 2352 Posted September 19, 2021 39 minutes ago, dummzeuch said: Looks like Perl to me, only with less special characters. It's Python. Perl's conditional operator is the same as C. That looks completely different. And has the condition first. Quote unlike how it is done in Python. 1 Share this post Link to post
dummzeuch 1512 Posted September 19, 2021 It just reminded me of conditional execution of statements with appended conditions: DoSomething if condition I don't remember the specifics. I rarely program in Perl nowadays. Share this post Link to post
David Heffernan 2352 Posted September 19, 2021 1 hour ago, dummzeuch said: It just reminded me of conditional execution of statements with appended conditions: DoSomething if condition Ah, yes, I see now! 1 hour ago, dummzeuch said: I rarely program in Perl nowadays. Wise 1 Share this post Link to post