Hi Andrew,
1)
zot1: make function! [
"Defines a user function with given spec and body."
[catch]
spec [block!] {Help string (opt) followed by arg words (and opt type and
string)}
body [block!] "The body block of the function"
][
throw-on-error [make function! spec body]
]
source zot1
Result:
zot1: func [
"Defines a user function with given spec and body."
[catch]
spec [block!] {Help string (opt) followed by arg words (and opt type and
string)}
body [block!] "The body block of the function"
][
throw-on-error [make function! spec body]
]
2)
zot2: func load mold third :func copy/deep second :func
Load Mold is needed instead of Copy/deep (I think, that you will find out
why)
3)
FYI Throw-on-error simply executes, that's all.
HTH Ladislav
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, October 10, 2000 9:52 AM
Subject: [REBOL] Bug? 'func not really 'func
> REBOL/View 0.10.38.3.1 3-Oct-2000
> Copyright 2000 REBOL Technologies. All rights reserved.
> >> source func
> func: func [
> "Defines a user function with given spec and body."
> [catch]
> spec [block!] {Help string (opt) followed by arg words (and opt type
and
> string)}
> body [block!] "The body block of the function"
> ][
> throw-on-error [make function! spec body]
> ]
> >> first :func
> == [spec body]
> >> second :func
> == [
> throw-on-error [make function! spec body]
> ]
> >> third :func
> == [
> "Defines a user function with given spec and body."
> [catch]
> spec [block!] {Help string (opt) followed by arg wor...
> ----^^^^^^^^^^^^^
> Take special notice of "spec [block!]" here.
>
> >> zot: func copy/deep third :func copy/deep second :func
> -------------^^^^^^^^^^^^^^^
> That should make a copy, shouldn't it? Let's check:
>
> >> third :zot
> == [
> "Defines a user function with given spec and body."
> [catch]
> spec [datatype!] {Help string (opt) followed by arg ...
> ----^^^^^^^^^^^^^^^^
> Hmmmm... That seems a little odd?!
>
> >> source zot
> zot: func [
> "Defines a user function with given spec and body."
> [catch]
> spec [datatype!] {Help string (opt) followed by arg words (and opt
type
> and string)}
> body [datatype!] "The body block of the function"][
> throw-on-error [make function! spec body]]
> >> test: zot [arg] [none]
> ** Script Error: zot expected spec argument of type: datatype.
> ** Where: test: zot [arg] [none]
>
> >> f: func [arg] [none]
> >> source f
> f: func [arg][none]
> Where did 'throw-on-error go to?! After all it's present here:
>
> >> source func
> func: func [
> "Defines a user function with given spec and body."
> [catch]
> spec [block!] {Help string (opt) followed by arg words (and opt type
and
> string)}
> body [block!] "The body block of the function"
> ][
> throw-on-error [make function! spec body]
> ]
>
> Looks like there's _two_ 'func in Rebol.
>
> Andrew Martin
> ICQ: 26227169
> http://members.nbci.com/AndrewMartin/
> -><-
>
>
>