On Wednesday, 19-January-2005 at 19:17:54 Peter wrote,

>I have started to question whether it is best to use Rebol's automatic type
>checking of parameters or not when designing functions.

One reason not given so far for using it is that it makes it easy to see what 
types a function will accept.  Compare READ and LOAD for instance...

>> ? read
USAGE:
    READ source /binary /string /direct /no-wait /lines /part size
    /with end-of-line /mode args /custom params /skip length

DESCRIPTION:
     Reads from a file, url, or port-spec (block or object).
     READ is a native value.

ARGUMENTS:
     source -- (Type: file url object block)

>> ? load
USAGE:
    LOAD source /header /next /library /markup /all

DESCRIPTION:
     Loads a file, URL, or string. Binds words to global context.
     LOAD is a native value.

ARGUMENTS:
     source -- (Type: file url string any-block binary)

READ's description gets it right about what types are accepted, but LOAD's 
doesn't.  Without them in the arguments, we'd have to view (and understand) the 
source to be sure what can and can't be accepted - and probably need to enclose 
the function in an error-trap anyway, just to be on the safe side.  Long term, 
you'll probably find this will apply to your own functions as well.

-- Carl Read.



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 1/19/05

-- 
To unsubscribe from the list, just send an email to rebol-request
at rebol.com with unsubscribe as the subject.

Reply via email to