[fpc-devel] Proposal: IIF - IfThen Cond True False

Paul Ishenin ip at kmiac.ru
Wed Jan 12 07:45:39 CET 2011


12.01.2011 13:28, kingbizugo at gmail.com wrote:
> The problem: we have to do *one function for every type*, on the C and
> PHP method is is *globally*
> If we want one for Integer we must declare one for it, if we want one
> for X we need to declare it...
>
> I want to know from you, what you would think about it on FPC? I don't
> belive that it is a hard feature to implement and is helpfull. I'll be
> waiting for your response!

Similar to delphi generic method:
  function IIf<T>(Condition: Boolean; IfTrue, IfFalse: T): T;
  begin
    if Condition then
      Result := IfTrue
    else
      Result := IfFalse;
  end;

I'm working on this functionality for classes, objects and record methods.

But even delphi does not have it for regular procedures/functions. I 
suppose because regular procedures/functions does not support overloading.

Best regards,
Paul Ishenin




More information about the fpc-devel mailing list