Can a Handler Differentiate Between Empty & Missing Parameters?

Ken Ray kray at sonsothunder.com
Thu Mar 9 15:20:22 EST 2006


On 3/9/06 2:05 PM, "Rob Cozens" <rcozens at pon.net> wrote:

> Hi All,
> 
> Given a handler such as:
> 
> on myHandler requiredParam, at optionalParam
> 
> can myHandler differentiate between
> 
> put empty into optionalParam
> myHandler requiredParam,optionalParam
> 
> and
> 
> myHandler requiredParam,
> 
> ?

Well, first of all you can't call a handler like:

  myHandler requiredParam,

because the trailing "," causes an error when trying to close the script.

If you provide *no* second param:

  myHandler requiredParam

Then you get an error trying to *execute* the command because
pass-by-reference parameters can't be optional.

And if you provide empty as the second param:

  myHandler requiredParam,""

You *also* get an error because the second param is not a variable, and so
it won't work with pass-by-reference parameters.

So the original question is moot...

Of course you might want to vote for Bug #741, as I suggested optional PBR
variables as an enhancement to Rev...

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list