Hi Rodney

Yeah, mine does that too.  It is even weirder than that.  Look at this
script.  When no args are supplied, the function f is not called, when an
arg is supplied for the 6th call, the function is called all 6 times!  I
think you have found a genuine REBOL bug and have CC'd our correspondence to
feedback.  Of course, the bug credit is yours.

Cheers

Larry

REBOL []

print {
 Bug in optional args called from script.
 If  123 is removed from the 6th call to f,
 f is not called at all.
}


f: func [a [any-type!]][print "f got called"]

f
f
f
f
f
f 123
halt

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 21, 2000 11:35 AM
Subject: [REBOL] Optional Arguments Working? Re:(2)


> Hi Larry,
>
> My user.r is minimal - just a set-net[] and a
> system/view/ check for /View beta 4.1 (v 0.9.9.3.1).
> No other scripts get invoked before this (it happens
> on a fresh instance of /View after a reboot).
>
> I am using WinNT4 SP3.
>
> Here is one difference I just noticed, though.  If
> I type the f: function directly in the console window
> and then invoke it by typing f - it works and I get
> "hello" back.  If I put the same thing in a script
> called test.r (below) and type do %test.r - I get
> nothing printed.
>
> Does this also happen for you?  I get the same behavior
> on my home Win98 machine using /Core.
>
> Thanks,
>
> Rodney
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 21, 2000 11:06 AM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Optional Arguments Working? Re:
>
>
> Hi Rodney
>
> >> source f
> f: func [a [any-type!]][print "hello"]        ;cut-and-pasted from your
> e-mail
> >> f
> hello
> >> f "abc"
> hello
> >>
>
> Hmm, all of the example from the user guide and your function, F, work
fine
> on my setup using Viewbeta4.1 on Win98.  What OS are you using?  What is
in
> your user.r file and other scripts that may have been invoked before the
> code in question?
>
> -Larry
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 21, 2000 9:19 AM
> Subject: [REBOL] Optional Arguments Working?
>
>
> > Maybe this has been discussed on the list before
> > but if I copy/paste the example in the users-guide
> > about how to use optional arguments in a function:
> >
> > print-vals: func [arg1 arg2 [any-type!]] [
> >     print either value? 'arg2 [[arg2 arg1]][arg1]
> > ]
> >
> > print-vals "abc"
> > abc
> >
> > print-vals "abc" 123
> > 123 abc
> >
> > I never get the example results.  If I don't really pass a
> > second value to print-vals I get a "Script Error - "abc" has
> > no value".  If I try:
> >
> > f: func [a [any-type!]][print "hello"]
> >
> > f
> >
> > Now I get no Script Error but the function never gets called
> > ("hello" doesn't print unless I actually pass an arg).
> >
> > I've tried this with the same results on /Core, /Command, and /View.
> >
> > What am I doing wrong?
> >
> > TIA,
> >
> > Rodney
> >
>

Reply via email to