[REBOL] Re: using type? with switch
From: tim:johnsons-web at: 1-Oct-2001 14:53
On Mon, Oct 01, 2001 at 03:44:47PM -0600, Gregg Irwin wrote:
> Is is possible to use the result of type? with switch? I.e. if I want to use
> switch to dispatch based on different data types, it seems I have to use
> to-string on the result of type? for use with switch. Is that the case or am
> I missing something?
; Here is an example of an approach that I use
switch/default form type? filename[
"string"[
either (system/words/find filename "ftp://") = filename[
filename: to-url filename
][filename: to-file filename]
] "file"[] "url"[] ; code blocks to be added as needed
][toss["filename in update must be string, url, or file type"]]
; 'toss is user-defined error handler
> --Gregg
>
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.johnsons-web.com