IfThen() intrinsic removed

classic Classic list List threaded Threaded
44 messages Options
123
Reply | Threaded
Open this post in threaded view
|

IfThen() intrinsic removed

Sven Barth-2
Hello together!

The IfThen() intrinsic has been removed again. There will be *no*
replacement in the foreseeable future. This is not up for discussion.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

John Lee
luddite_clique 1 progressives 0  

On 4 February 2016 at 19:25, Sven Barth <[hidden email]> wrote:
Hello together!

The IfThen() intrinsic has been removed again. There will be *no*
replacement in the foreseeable future. This is not up for discussion.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Bart-48
On 2/4/16, John Lee <[hidden email]> wrote:

> luddite_clique 1 progressives 0

Please don't start a flame war.

Bart
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

dmitry boyarintsev
In reply to this post by John Lee
On Thu, Feb 4, 2016 at 2:44 PM, John Lee <[hidden email]> wrote:
luddite_clique 1 progressives 0  

Just wait for Delphi to implement this... speaking of which, why they've not done it a long time ago?
They could, but probably didn't do that, for very likely the same reasons.

thanks,
Dmitry

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Felipe Monteiro de Carvalho
In reply to this post by Sven Barth-2
Disappointed :(

Why was it done? I thought that pretty much everyone was in favor?

It isn't very pascalish, that's true, but we could implement it like
the proposed "inline if A then B else C" syntax... which is very
pascalish and cool.

thanks,
--
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Mazo Winst
2016-02-04 18:41 GMT-02:00 Felipe Monteiro de Carvalho <[hidden email]>:
Disappointed :(

Why was it done? I thought that pretty much everyone was in favor?


Due to the fact that we like flame, flame and flame
 
It isn't very pascalish, that's true, but we could implement it like
the proposed "inline if A then B else C" syntax... which is very
pascalish and cool.


Lets wait for the Delphi implementation so, we will not start a new flame.

The same applies to the ARC objects.

Best regards
 


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Felipe Monteiro de Carvalho
On Thu, Feb 4, 2016 at 7:03 PM, Mazola Winstrol <[hidden email]> wrote:
> Lets wait for the Delphi implementation so, we will not start a new flame.

You mean like "wait 5-10 years until they decide independently that
they want to do it" or are there serious plans for Delphi to support
this, say, in the next version?

> The same applies to the ARC objects.

What's that?

--
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Mazo Winst
2016-02-04 19:13 GMT-02:00 Felipe Monteiro de Carvalho <[hidden email]>:
On Thu, Feb 4, 2016 at 7:03 PM, Mazola Winstrol <[hidden email]> wrote:
> Lets wait for the Delphi implementation so, we will not start a new flame.

You mean like "wait 5-10 years until they decide independently that
they want to do it" or are there serious plans for Delphi to support
this, say, in the next version?

I mean we are not able to introduce new features to the compiler if these features do not exists in Delphi. We prefer flame.

 
> The same applies to the ARC objects.

What's that?


Reference-counted objects. Class instances are counted by reference so, this feature eliminates the need to manually manage memory with the try...finally blocks to free objects from the memory.

Best regards

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

vojtech.cihak
In reply to this post by Sven Barth-2

Hi,

I personally think that there's no place for democracy in compiler development. It would lead to bloat. Although majority of people considered it useful, it was not very pascalish.

Trunk is place for experiments and this one is over.

 

V.

______________________________________________________________
> Od: Sven Barth <[hidden email]>
> Komu: "FPC-Pascal users discussions" <[hidden email]>
> Datum: 04.02.2016 20:25
> Předmět: [fpc-pascal] IfThen() intrinsic removed
>

Hello together!

The IfThen() intrinsic has been removed again. There will be *no*
replacement in the foreseeable future. This is not up for discussion.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Michael Van Canneyt
In reply to this post by Felipe Monteiro de Carvalho


On Thu, 4 Feb 2016, Felipe Monteiro de Carvalho wrote:

> Disappointed :(

Well, such is life.
I'm also disappointed that my bank account doesn't contain millions.
But I learned to live with it :-)

But all hope is not lost yet.

> Why was it done? I thought that pretty much everyone was in favor?

Not quite, form was also deemed important. It is a tricky balance.

To recapitulate:

There were various choices:

a) not adding at all
b) a ? b : c
c) if a then b else c
d) iif()    (or some variant thereof)

From the people that responded in the core discussion, the majority was for the
a ? b : c
syntax, or not adding at all (not all replied).

Now, the functional form (ifthen(), iif() or whatever) is not consistent with the
semantics of other functions, namely that all arguments are evaluated.
Opinions on the importance of this argument may vary, but it must not be ignored.

Since the functional form (IfThen) violates above rule, it was removed again.

Sven did not feel like introducing the a ? b : c  syntax, so it was not added.

If someone feels like submitting a patch that implements a ? b : c, it may well be taken under advisement.
I heard no-one speaking out clearly against the actual functionality (well, maybe one) or the a ? b : c form.

Sven simply didn't want to implement the a ? b : c form.

This should be respected, each works on what (s)he wants to work.
That is not to say that all work done is automatically and irrevocably
added to the compiler.

Experiments can be done, but can also be discarded.

> It isn't very pascalish, that's true, but we could implement it like
> the proposed "inline if A then B else C" syntax... which is very
> pascalish and cool.

'Cool' is a very personal appreciation.
Some men like blondes, others prefer redheads or brunettes.

For example, I don't think this is pascalish or cool.

Rationale for protest (there may have been other reasons beside the below):

"if then" is a statement. This is a clear and unambiguous rule.

Allowing "if then" as part of an expression is introducing ambiguity and error prone.

Samples of non-desirable constructs include:

Type
   TMyArray = Array[1..if sizeof(integer)=2 then 4 else 5] of integer;

   myconst = if sizeof(integer)=2 then 4 else 5;

   Procedure Something(AA : Integer = if sizeof(integer)=2 then 4 else 5);

   Property A : Integer Index if sizeof(integer)=2 then 4 else 5 read geta;

   Property B : Integer Read FA Write FA default if sizeof(integer)=2 then 4 else 5 ;

And - in my eyes - the topper in horror:

   if if if a then b else c then e else g then
      DoSomething
   else if if h then i else j then
      DoSomethingElse;

The last construct works more or less in C-like languages, because they mostly
require brackets in the if(), clearly separating the if from the conditional :

   if (a?b:c?e:g) {
   } if (h?i:j) {
   }

(whether or not one actually wants to use/read this even in C is another matter)

Then, let me point out also that the gain of this construct in terms of
functionality may well be marginal.

Introducing the following generic function:

Generic function IIF<t>(Const Cond: Boolean; Const ATrueValue,AFalseValue : T) : t; inline;

(name and exact declaration may well differ, and Sven still needs to fix some inline bug)

Will solve most likely most of the use cases. I am not really a fan of generics,
but the above demonstrates its power clearly.

The only use case that would be gained is the non-evaluation of one of the arguments.

To introduce a highly controversial construct for maybe marginal gain is not advisable.

That about sums up what was said about this in core.

As you see, it is not necessarily permanently off the drawing board,
but has definitely been put in the (deep) freezer.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

silvioprog
On Thu, Feb 4, 2016 at 6:33 PM, Michael Van Canneyt <[hidden email]> wrote:
On Thu, 4 Feb 2016, Felipe Monteiro de Carvalho wrote:

Disappointed :(

Well, such is life. I'm also disappointed that my bank account doesn't contain millions. But I learned to live with it :-)
[...]

:-D

[...]
That about sums up what was said about this in core.

Thanks a lot for all explanations.

--
Silvio Clécio

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Felipe Monteiro de Carvalho
In reply to this post by Michael Van Canneyt
On Thu, Feb 4, 2016 at 7:33 PM, Michael Van Canneyt
<[hidden email]> wrote:
> b) a ? b : c
> From the people that responded in the core discussion, the majority was for
> the a ? b : c syntax, or not adding at all (not all replied).

You mean like literally using "?" and ":" ?

> If someone feels like submitting a patch that implements a ? b : c, it may
> well be taken under advisement. I heard no-one speaking out clearly against
> the actual functionality (well, maybe one) or the a ? b : c form.

aha, I see, Sven's message wasn't clear about it, it sounded like core
is completely against any implementation.

While actually simply no-one is working on the desired solution, which
are 2 very different things.

> "if then" is a statement. This is a clear and unambiguous rule.

The idea was "inline if" not "if"

--
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Michael Van Canneyt


On Thu, 4 Feb 2016, Felipe Monteiro de Carvalho wrote:

> On Thu, Feb 4, 2016 at 7:33 PM, Michael Van Canneyt
> <[hidden email]> wrote:
>> b) a ? b : c
>> From the people that responded in the core discussion, the majority was for
>> the a ? b : c syntax, or not adding at all (not all replied).
>
> You mean like literally using "?" and ":" ?

Yes. As used in C-like languages.

>> If someone feels like submitting a patch that implements a ? b : c, it may
>> well be taken under advisement. I heard no-one speaking out clearly against
>> the actual functionality (well, maybe one) or the a ? b : c form.
>
> aha, I see, Sven's message wasn't clear about it, it sounded like core
> is completely against any implementation.

Quoting Sven:

"There will be *no* replacement in the foreseeable future."

So

"Foreseeable future" <> "eternity" ? "may be implemented" : "will never be implemented"

> While actually simply no-one is working on the desired solution, which
> are 2 very different things.

Provided you know what the 'desired solution' is, yes.

>> "if then" is a statement. This is a clear and unambiguous rule.
>
> The idea was "inline if" not "if"

I don't think you are right there, but it doesn't make a difference either way.

Whether or not 'if' is preceded by 'inline' is irrelevant.

'if then else' says 'statement', not 'expression'.

'?' clearly says 'operator' hence, 'expression'.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Graeme Geldenhuys-6
In reply to this post by Michael Van Canneyt
On 2016-02-04 21:33, Michael Van Canneyt wrote:
> Samples of non-desirable constructs include:

Thanks goodness. Looking at some of your examples, that is a whole new
can of worms, and far from what I think the Pascal language stands for.

Regards,
  - Graeme -


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Graeme Geldenhuys-6
In reply to this post by Michael Van Canneyt
On 2016-02-04 21:33, Michael Van Canneyt wrote:
> I'm also disappointed that my bank account doesn't contain millions.
> But I learned to live with it :-)

Ah, you give up too soon. ;-)


Regards,
  - Graeme -

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Michael Van Canneyt


On Thu, 4 Feb 2016, Graeme Geldenhuys wrote:

> On 2016-02-04 21:33, Michael Van Canneyt wrote:
>> I'm also disappointed that my bank account doesn't contain millions.
>> But I learned to live with it :-)
>
> Ah, you give up too soon. ;-)

You're more than welcome to donate. Shall I give you my IBAN ?
Can't promise it's tax-deductible, though :-)

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Martin Friebe
In reply to this post by Michael Van Canneyt
On 04/02/2016 22:13, Michael Van Canneyt wrote:
>
> On Thu, 4 Feb 2016, Felipe Monteiro de Carvalho wrote:
>>
>> You mean like literally using "?" and ":" ?
>
> Yes. As used in C-like languages.

There was also voices for a more verbose solution.

But introducing 2 new operators based on words (a-z, not 16 bit) means 2
new keywords and causes conflicts.
Except if "then" and "else" are used (but without "if")
x := 1 < 3 then 5 else 4;

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Graeme Geldenhuys-6
In reply to this post by Michael Van Canneyt
On 2016-02-04 22:25, Michael Van Canneyt wrote:
> You're more than welcome to donate. Shall I give you my IBAN ?
> Can't promise it's tax-deductible, though :-)

:-D



G.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

Sven Barth-2
In reply to this post by Martin Friebe

Am 04.02.2016 23:43 schrieb "Martin" <[hidden email]>:
>
> On 04/02/2016 22:13, Michael Van Canneyt wrote:
>>
>>
>> On Thu, 4 Feb 2016, Felipe Monteiro de Carvalho wrote:
>>>
>>>
>>> You mean like literally using "?" and ":" ?
>>
>>
>> Yes. As used in C-like languages.
>
>
> There was also voices for a more verbose solution.
>
> But introducing 2 new operators based on words (a-z, not 16 bit) means 2 new keywords and causes conflicts.
> Except if "then" and "else" are used (but without "if")
> x := 1 < 3 then 5 else 4;

No. Think about the ambiguities that arise if you use this inside the condition of an if-statement.

Regards,
Sven


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: IfThen() intrinsic removed

el_es


On 05/02/16 07:03, Sven Barth wrote:

> Am 04.02.2016 23:43 schrieb "Martin" <[hidden email] <mailto:[hidden email]>>:
>>
>> On 04/02/2016 22:13, Michael Van Canneyt wrote:
>>>
>>>
>>> On Thu, 4 Feb 2016, Felipe Monteiro de Carvalho wrote:
>>>>
>>>>
>>>> You mean like literally using "?" and ":" ?
>>>
>>>
>>> Yes. As used in C-like languages.
>>
>>
>> There was also voices for a more verbose solution.
>>
>> But introducing 2 new operators based on words (a-z, not 16 bit) means 2 new keywords and causes conflicts.
>> Except if "then" and "else" are used (but without "if")
>> x := 1 < 3 then 5 else 4;
>
> No. Think about the ambiguities that arise if you use this inside the condition of an if-statement.
>
What if it required use of braces:

x := (expression then truevalue else falsevalue);

?
> Regards,
> Sven
>

el es


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
123