I have started to question whether it is best to use Rebol's automatic type
checking of parameters or not when designing functions.
If the type checking is used, calling a function with an incorrect type of
value causes a script error, eg:
>> a: func [b [date!]] [print b]
>> a 12345
** Script Error: a expected b argument of type: date
** Near: a 12345
However, if you don't use the built-in type checking, you can return a none!
value and give the caller the option (and responsibility) to deal with the
situation, eg:
>> a: func [b] [if type? b <> date! [return none]]
>> a 12345
== none
Given that Rebol is not strongly typed, is the second of these "idioms" the
more appropriate?
Regards
Peter
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.7.0 - Release Date: 17/01/2005
--
To unsubscribe from the list, just send an email to rebol-request
at rebol.com with unsubscribe as the subject.