Interesting insights from PROTECT
Here's an interesting topic to chat about with your close friends around the fireplace this evening... (does anyone still do that, or is it just Facebook now?)
As I mentioned in my last blog, the protect function has been enhanced to allow it to make any series or object read-only. It's part of R3-A43. (The details are in protect function in the R3 Doc wiki.)
Now, things can get interesting if you do these lines:
The first line just protects the system word itself. No big deal.
** Script error: protected variable - cannot modify: system
So, that's a good thing.
The second line protects the variables of the system object:
** Script error: protected variable - cannot modify: version
Now things are getting interesting. Kind of useful, no?
However, it does create this interesting situation:
** Script error: protected variable - cannot modify: script
This happens because the system/script object is updated by do when the chat program is downloaded from the remote web site.
So, we still have some work to do... mainly, to define the true meanings of fields and access policies of the system object.
Now, for that last line...
In theory, this write-protects every series in the system. I say "in theory" because yet to be fully tested.
At first I figured the system would crash. But, I was pleased to discover it still worked fairly well:
do load %hello.r ; work around system/script issue
But, we know that any mezzanine function that holds writable statically defined local data will be a problem. I'm sure it wouldn't take you long to find a function that blows out with a protection error.
But, there's quite a positive side to this experiment... the better we get it working (the fewer the errors) the closer we are to being able to share these definitions between multiple tasks. It's a necessary pre-qualifier for multitasking (or "threading", if you want to call it that, but not really, more like lean-tasks.)
Ok, so tonight, enjoy the fire, your friends, and the lively conversation starter I've given you here, in this blog.