#1 2016-08-15 02:18

aip1000
Member
Registered: 2016-08-15
Posts: 8

PascalScript: Procedures/Functions with Optional Parameters

My understanding is that Pascal can support optional parameters, in the form:

function FilterFile(S: WideString; isEnabled: Boolean = True): WideString;

In ReNamer, I get a compiler error (semicolon expected). Can someone confirm whether or not optional parameters are supported by ReNamer's PascalScript rules?

Thanks

Offline

#2 2016-08-15 10:33

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,479

Re: PascalScript: Procedures/Functions with Optional Parameters

Pascal language does support optional parameters, but unfortunately the PascalScript engine does not.

This might change in the future.

Offline

#3 2016-08-15 10:34

aip1000
Member
Registered: 2016-08-15
Posts: 8

Re: PascalScript: Procedures/Functions with Optional Parameters

Good to know; thanks for the heads up!

Offline

#4 2016-09-20 08:11

Hannibal
Member
Registered: 2016-09-19
Posts: 1

Re: PascalScript: Procedures/Functions with Optional Parameters

den4b wrote:

Pascal language does support optional parameters, but unfortunately the PascalScript engine does not.

This might change in the future.

I hope it does change at some point.

Offline

#5 2016-09-20 09:46

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,479

Re: PascalScript: Procedures/Functions with Optional Parameters

Hannibal wrote:

I hope it does change at some point.

We all do, but I wouldn't hold your breath while waiting for it.

Not having optional parameters is just a minor inconvenience, not a show stopper. You can always have slightly different names for functions which take fewer arguments and assume default values.

For example:

function IncrementBy(X: Integer; Y: Integer): Integer;
begin
  Result := X + Y;
end;

function Increment(X: Integer): Integer;
begin
  Result := IncrementBy(X, 1); // Default of 1 is assumed
end;

Offline

Board footer

Powered by FluxBB