Use of Ellipsis

Compiler (edit 880) language extension: use of ellipsis (...) in argument lists to facilitate passing arguments through a wrapper function. An example will make this more clear. Consider the following function:

Function Fn'DynFunc$(fn$ as s260:inputonly, ...) as s0

    on error goto trap

    Fn'DynFunc$ = dynfunc$(fn$, ...)

    exitfunction

trap:

    if err(0) = 72 then             ! if function not found

        Fn'DynFunc$ = .NULL         ! set result to null

        resume endfunction          ! and return with no error

    else

        resume endfunction with_error   ! else pass error through

    endif                          

EndFunction

 

The function serves as a wrapper to the underlying dynfunc$() call; it adds value by trapping the function-not-found error and returning .NULL instead. The ellipsis mechanism eliminates what would otherwise be a sticky problem - we have no idea how many parameters will be passed, so there is no good way to code the dynfunc$() call. With the ellipsis mechanism, the "..." in the dynfunc$(fn$, ...) call is replaced by the actual parameters corresponding to the ...in the Fn'DynFunc$() call, allowing us to pass them through without knowing anything about them.