Please enable JavaScript to view this site.

Added October 2018

The use of ellipsis (...) in argument lists facilitates 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.

History

2018 September, A-Shell 6.5.1647, compiler edit 880:  Added function to A-Shell

Created with Help+Manual 9 and styled with Premium Pack Version 5 © by EC Software