Hi Volker,

you wrote:
>use and /local have another bug: you can't look in after an error!

I'm not sure how you were trying to "look in":

>> f: func [/local a] [a: 1 1 / 0]

will cause a divide by zero error:

>> f
** Math Error: Attempt to divide by zero.
** Where: 1 / 0

Now let's look at the value of a:

>> first second :f
== a:

>> get first second :f
== 1

"Looked in" and saw that a evaluates to 1. You must mean something quite
different?

>a question: [a: do [print "1"]] does not work, how can i handle this too?
>i wanted to return the result of [do b] this way, with some lines after it
>[.. e: do b  if a-option [..]  "return" e ] ?

print returns nothing, and nothing is a value of type unset!:
>> type? print "hello"
hello
== unset!

>> type? do [print "hello"]
hello
== unset!

>> print mold do [print "hello"]
hello
** Script Error: mold is missing its value argument.
** Where: print mold do [print "hello"]

When type? returns the datatype unset! it is reporting that there was no
value:

>> type?
== unset!

There is no value to assign to 'a in your example. Otherwise it works as
you expect (?):
>> f: func [] [a: do [1 + 1] return a]
>> f
== 2

>"code"
>local: func[a "vars" b "script" /local c d ][
>    c: copy[]   foreach i a[ append c to set-word! i]   append c none

You could simplify your foreach loop:

foreach i a [
  append c compose [(to set-word! i) none]
]


>    d: make object! c   bind b in d 'self    do b   d]
>
>"test" do [
>a: "-a" b: "-b"
>probe the-locals: local[a b][ a: 10 b: 20]
>probe a probe b probe the-locals
>]
>
>
>Volker
>
>
>

;- Elan >> [: - )]

Reply via email to