Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Bug? 'func not really 'func

From: al:bri:xtra at: 9-Oct-2000 23:52

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/