Re: function signature [message #51127] |
Fri, 27 October 2006 17:02 |
Dominic[1]
Messages: 13 Registered: October 2006
|
Junior Member |
|
|
Ok, but is it possible to make the "bar" parameter mandatory at compile
time?
thanks,
dometz
mgalloy@gmail.com wrote:
> Dominic wrote:
>> Hi,
>>
>> Is there a way to add signatures to user written function and
>> procedures? So that validation of method calls are made at compile time
>> vs. run time?
>>
>> example:
>>
>> pro foo, bar
>> ...
>> end
>>
>> some calls in his code:
>> pro calling_foo
>> foo ;without the bar parameter
>> end
>>
>> So, is there a way when calling_foo is compile that it will catch this
>> error at compile time as a syntax error?
>
> But it's not a syntax error. The "bar" parameter might be optional (it
> is up to the "foo" routine to determine what it needs).
>
> On the other hand,
>
> pro foo
> ...
> end
>
> pro calling_foo
> foo, bar
> end
>
> is a syntax error.
>
> Mike
> --
> www.michaelgalloy.com
|
|
|
Re: function signature [message #51129 is a reply to message #51127] |
Fri, 27 October 2006 16:21  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
Dominic wrote:
> Hi,
>
> Is there a way to add signatures to user written function and
> procedures? So that validation of method calls are made at compile time
> vs. run time?
>
> example:
>
> pro foo, bar
> ...
> end
>
> some calls in his code:
> pro calling_foo
> foo ;without the bar parameter
> end
>
> So, is there a way when calling_foo is compile that it will catch this
> error at compile time as a syntax error?
But it's not a syntax error. The "bar" parameter might be optional (it
is up to the "foo" routine to determine what it needs).
On the other hand,
pro foo
...
end
pro calling_foo
foo, bar
end
is a syntax error.
Mike
--
www.michaelgalloy.com
|
|
|