[REBOL] [REBOL] Default Port Values? Re:(3)

2000-05-24 Thread agem


Want to add: 
You can 'probe for tracing,
 safe-close: func [p][if probe p  [] [close probe p]]
'probe will show you the values without modifying something.
good if one mistake content or the error-position.

(thanks for the more specific answers for inits :)

Volker

 Hi Ladislav:
 Yes, your code works for me. But I wrote a function
 as follows:
 safe-close: func [p[port!]][if p [close p]]
 lets say  
 dufus: none
 safe-close dufus
 generates
 Script Error: safe-close expected p argument of type: port
 HOWEVER:
 if I write 
 safe-close: func [p][if p  [] [close p]]
 dufus: []
 safe-close dufus
 I get no error message.
 :) Duh!! I know I have lots to learn yet.
 Thanks
 Tim
 Sorry, I don't understand. For me your code works:
 
  dufus-pointer: none
 == none
  either equal? dufus-pointer none [][close dufus-pointer]
 
 
 Ladislav
 
 
 
 
 




[REBOL] [REBOL] Default Port Values? Re:(3)

2000-05-23 Thread icimjs

Hi Tim,

Here
safe-close: func [p[port!]][if p [close p]]

you are insisting that the argument to safe-close must be a value of
datatype port!, [ p [port!] ]. Therefore you get an error message, whenever
you pass a value that is not of type port!.

In contrast, here

safe-close: func [p][if p  [] [close p]]

you are not declaring a type restriction on the values passed to
safe-close, [ p ]. Accordingly, safe-close does not complain that the value
is not of type port!. 

Confusing? Not really.

At 08:22 AM 5/23/00 -0800, you wrote:
Hi Ladislav:
   Yes, your code works for me. But I wrote a function
as follows:
safe-close: func [p[port!]][if p [close p]]
lets say  
dufus: none
safe-close dufus
generates
Script Error: safe-close expected p argument of type: port
HOWEVER:
if I write 
safe-close: func [p][if p  [] [close p]]
dufus: []
safe-close dufus
I get no error message.
:) Duh!! I know I have lots to learn yet.
Thanks
Tim
Sorry, I don't understand. For me your code works:

 dufus-pointer: none
== none
 either equal? dufus-pointer none [][close dufus-pointer]


Ladislav






;- Elan  [: - )]