Sven Barth wrote 10 lines
And I just noticed that I sent this to fpc-devel instead of fpc-pascal... *sigh*
So here it is again for fpc-pascal as well.
Regards,
Sven

Mailing lists / fpc-pascal / 2016-02
17 messages · 8 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
And I just noticed that I sent this to fpc-devel instead of fpc-pascal... *sigh*
So here it is again for fpc-pascal as well.
Regards,
Sven
2016-02-01 21:16 GMT+01:00 Sven Barth :
On 01.02.2016 21:14, Sven Barth wrote: > Time for the next flame.
Flame? :O It was constructive discussion :)
For me
x := if true then 0 else 1is ideal and compatible with Oxygene. +1 IMO no need to any other combination.
Maybe is time to start developing {$MODE OXYGENE} ?
+1. It was constructive discussion.
For me
x := if true then 0 else 1
For me, no problem extending ObjFPC to make a new abbreviated Pascal language, however, will be IfThen() function kept? (or something like this)
2016-02-01 21:16 GMT+01:00 Sven Barth : Flame? :O It was constructive discussion :) For me
Maciej Izak wrotex := 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 is considered a statement.
This is a rather drastic change in the basic definition of the language, but might be doable. I's completely optional, and I don't see how it might break anything.
But of course the paradigm would ask for being extended to many or all other keywords.
An obvious example is "case".
-Michael
Why would "0" now be a statement? As long as the "if" is the expression as well then the definition would be "if Condition then ThenExpr else ElseExpr", not "if Condition then ThenStmt else ElseStmt". Otherwise things like procedures ore assignments would be allowed as well which is not the case.
This is a rather drastic change in the basic definition of the language, but might be doable. I's completely optional, and I don't see how it might break anything.
Of course it's doable. See the patch I attached at the initial mail of this thread.
Regards,
Sven
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
John Lee wroteSo (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 theory be good to go as well. Just look at the first message of this thread for the patch to play around with it.
Regards,
Sven
I probably missed it, but what problem is "IfThen()" actually solving?
g.
The IfThen() is in trunk though it will at least be renamed. The if-then-else expression…
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
I probably missed it, but what problem is "IfThen()" actually solving? g. Proud owner of…
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: shortness of script
Pro #2: easier porting of C-style code (with ternary ? operator. Pascal doesn't have an equivalent
https://en.wikipedia.org/wiki/%3F:#Programming_languages_without_the_conditional_operator )
thanks,
Dmitry
So it's not solving a /problem/ it's lessening an inconvienence(sp!).
I would've gone with IIf(). :)
g.
geneb wroteSo 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 fpc-other list.
thanks,
Dmitry
You can't "close" a discussion thread on an email list. :)
Everyone are welcomed to create poll on the forum. Discussion also goes on at fpc-other list.
I don't have a dog in the fight, I was just making an observation.
g.
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.
Regards,
Sven
Sven Barth wroteYes, 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 work like that.
g.
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);
2) or add inconsistency by using function syntax but different behavior.
Best regards,
Flávio
etrusco wrote
Well:
program Project1; function test1: integer; begin WriteLn('A');
Result := 10; end; function test2: integer; begin WriteLn('B');
Result := 20; end; function CommonFunc(A: Boolean; B, C: integer):
integer; begin if A then Result := B else Result := C;
end;var X: LongInt;begin X := IfThen(True, test1, test2); WriteLn(X);
WriteLn('----'); X := CommonFunc(True, test1, test2); WriteLn(X);
ReadLn;end.
Result:
A10----BA10