Hi Tim,

Yes, you are right. The PROTECT functionality has some quirks. It looks
PROTECTed words are detected only when using set-word! and SET function:

>> d: context[a: 1]
>> protect in d 'a
>> set in d 'a 10
** Script Error: Word a is protected, cannot modify
** Near: set in d 'a 10
>> d/a: 10
== 10
>>

Besides set-path! it also doesn't work on series!:

>> b: [1 2 3 4 5]
== [1 2 3 4 5]
>> protect 'b
>> b: 10
** Script Error: Word b is protected, cannot modify
** Near: b: 10
>> b/2: 10
== 10
>> b
== [1 10 3 4 5]
>>

>> s: "abcd"
== "abcd"
>> protect 's
>> s: 5
** Script Error: Word s is protected, cannot modify
** Near: s: 5
>> s/2: #"x"
== #"x"
>> s
== "axcd"

I tried to submit it to RAMBO but it seems the system didn't record my
submission(don't know the reason?!?) so feel free to try report it.

Regards,

Cyphre



----- Original Message -----
From: "Tim Johnson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 05, 2006 5:19 PM
Subject: [REBOL] Re: Private words in objects?


>
> * Ladislav Mecir <[EMAIL PROTECTED]> [060705 00:09]:
> >
> > >
> > For protected variables see the PROTECT function.
>
>  Hi Ladislav: I've never been able to make protect operate on
>  a context or a member of a context:
>  see console session below:
> >> help protect
> USAGE:
>     PROTECT value
>
> DESCRIPTION:
>      Protect a word or block to prevent from being modified.
>      PROTECT is a native value.
>
> ARGUMENTS:
>      value -- The word or block of words to be protected (Type: word
block)
> >> d: context[a: 1]
> >> protect 'd
> >> d/a: 2
> == 2
> >> probe d
> make object! [
>     a: 2
> ]
> >> protect in d 'a
> >> d/a: 3
> == 3
> >> probe d
> make object! [
>     a: 3
> ]
> >> ;; Doesn't work!!
> >> protect d/a
> ** Script Error: protect expected value argument of type: word block
> ** Near: protect d/a
>
> tim
>
>
> --
> Tim Johnson <[EMAIL PROTECTED]>
>       http://www.alaska-internet-solutions.com
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to