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

Bug or feature?

 [1/9] from: kpeters:otaksoft at: 28-Dec-2007 16:02


I had accidentally written send-mail: function [ addr [string!] [email!] ] [... instead of send-mail: function [ addr [string! email!] ] [... but Rebol didn't complain. Bug or feature not understood by me? Or denoting the same thing? TIA Kai

 [2/9] from: pwawood:g:mail at: 29-Dec-2007 9:50


On Saturday, December 29, 2007, at 08:02 am, Kai Peters wrote:
> I had accidentally written > send-mail: function [ addr [string!] [email!] ] [...
<<quoted lines omitted: 3>>
> Bug or feature not understood by me? Or denoting > the same thing?
They aren't the same:
>> a: func [b [string!] [integer!]] [ print b] >> a 1
** Script Error: a expected b argument of type: string ** Near: a 1
>> a "1"
1 Only the original developer will really know if it is a bug or feature. Regards Peter

 [3/9] from: tim-johnsons::web::com at: 28-Dec-2007 17:36


On Friday 28 December 2007, Peter Wood wrote:
> Only the original developer will really know if it is a bug or feature.
Unfortunately, I have not been able to find any thorough documentation on the rebol inteface spec block. It needs some documentation and discussion. For instance, on linux, I can (and do) use multiple docstrings. I had to rewrite 'help to utilize that feature, and I happen to like it, but find no edification on the topic. In Kai's case, maybe he stumbled on something serendipitously ;-) Tim

 [4/9] from: carl:cybercraft at: 29-Dec-2007 7:11


On Friday, 28-December-2007 at 16:02:17 Kai Peters wrote,
>I had accidentally written > >send-mail: function [ addr [string!] [email!] ] [... > >instead of > >send-mail: function [ addr [string! email!] ] [... > >but Rebol didn't complain.
It complains with me at run-time...
>> send-mail: function [ addr [string!] [email!] ] [print "Huh?"]
** Script Error: function expected body argument of type: block ** Near: send-mail: function [addr [string!] [email!]] [print "Huh?"] Did you mean 'func and not 'function ? -- Carl Read.

 [5/9] from: kpeters:otaksoft at: 28-Dec-2007 20:42


On Sat, 29 Dec 2007 17:34:08 +1300, Carl Read wrote:
> On Friday, 28-December-2007 at 16:02:17 Kai Peters wrote, >> I had accidentally written
<<quoted lines omitted: 18>>
>> TIA >> Kai
No - am using function in this case.... Kai

 [6/9] from: gregg:pointillistic at: 28-Dec-2007 21:49


Hi Kai, It complains with me here, so I assume you meant to use FUNC. If that's the case...it's still undocumented behavior, but basically it ignores the unnamed param:
>> probe send-mail: func [ addr [string!] [email!] xx [integer!]] [print xx]
func [addr [string!] [email!] xx [integer!]][print xx]
>> send-mail "test" 1
1 -- Gregg

 [7/9] from: kpeters:otaksoft at: 28-Dec-2007 20:53


On Fri, 28 Dec 2007 21:49:10 -0700, Gregg Irwin wrote:
> Hi Kai, > It complains with me here, so I assume you meant to use FUNC. If that's the case...it's still
<<quoted lines omitted: 5>>
> 1 > -- Gregg
Hi Gregg ~ just doublechecked - it's function, doesn't complain and runs fine: send-mail: function [ addr [string!] [email!] ] [] [ either addr = "" [ alert/title "Cannot send email to empty address" "Error" ] [ browse join "mailto:" addr ] ]

 [8/9] from: carl::cybercraft::co::nz at: 29-Dec-2007 7:11


On Friday, 28-December-2007 at 20:42:09 Kai Peters wrote,
>On Sat, 29 Dec 2007 17:34:08 +1300, Carl Read wrote: >> It complains with me at run-time...
<<quoted lines omitted: 15>>
>>> Kai >No - am using function in this case....
Yes - my fault. 'function needs another block...
>> send-mail: function [ addr [string!] [email!] ] [] [print "Huh?"] >> send-mail "xx"
Huh?
>> probe :send-mail
func [addr [string!] [email!] /local][print "Huh?"] And at its most minimal...
>> test: func [[]][print "Huh?"] >> test
Huh? It seems it just ignores any superfluous values...
>> test: func [1.2.3][print "Huh?"] >> test
Huh? As Gregg pointed out in a video a while back, functions are a dialect, and obviously one that allows for a bit of noise... -- Carl Read.

 [9/9] from: dhsunanda::gmail::com at: 29-Dec-2007 22:32


> test: func [1.2.3][print "Huh?"] > test
You can see the "canonical" format of a func's args like this: a: func [1 b 2][print b] == [b] It certainly looks like anything that is not a word or a block is just ignored. Sunanda

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted