Re: And another crm114 script language question about 'isolate'

Paolo <[email protected]>
Newsgroups gmane.mail.spam.crm114
Message-ID <20080331192634.GQ25908@localhost>
On Mon, Mar 31, 2008 at 07:10:34AM +0100, Ger Hobbelt wrote:
> Ja-a-a-aaa, so far with you all the way. But-t-t-t lemme rephrase: the
> wonder starts (started, I should say) here:
> 
> {
>     window
>     isolate (:a:)           # --> 'a'
>     output /a = ':*:a:'\n/  #
>     isolate (:a:) /foo/     # --> 'foo' (override; old 'a' is lost
>     output /a = ':*:a:'\n/  #
>     isolate <default> (:a:) /bar/  # --> in this case, :a: will _stay_ 'foo'
>     output /a = ':*:a:'\n/  #
>     isolate (:a:)
>     output /a = ':*:a:'\n/  # now what do you expect here? Then run
> and see if reality matches brain. For me it didn't.
> }
> 
> (source attached)
> 
> Please think about the last isolate before you check and run it: this
> is a perception check after all.

I get:

a = ''		# ok, no val assigned yet
a = 'foo'	# ok, re-isolate + val-assign
a = 'foo'	# ok, not touched because of <default> 
a = 'foo'	# ok, just re-isolate, but don't bother the value 

looks alright to me.

> I have learned the hard way that I had forgotten something important
> about 'isolate' and why it is called exactly that ('isolate', and not,
> say, 'instantiate', 'declare' or 'allocate')

yeah ;) - note the last ISOLATE: you'd do just that after a MATCH (:: :a:) ...
if you'd like to save :a: and its value. If you redo it, it checks if it's 
already there and ISOLATE'd, then skip if yes.

In diagrams (showing just values):

 main buffer         : .............foo..........
 var :x:             :      ^----------------^

after MATCH (:: :a:) [:x:] /foo/
 
 string buffer       : .............foo..........
 var :x:             :      ^----------------^
 var :a:             :              ^-^

now :a: is bound to :x:, if you change :x: you (may) change :a: as well; if
you change :a: you do change :x: as well.

after ISOLATE (:a:) - unbind :a: from :x: :
 
 string buffer: .............foo..........
 var :x:      :      ^----------------^

 other/isolate buffer: .............foo............
 var :a:             :              ^-^

ISOLATE (:a:) - again wouldn't do anything at this point;
ISOLATE <default> (:a:) /bar/ - wouldn't be allowed to change val;
ISOLATE (:a:) /bar/ - would only need to change the value;
ALTER (:x:) // - would change just :x:
ISOLATE (:x:) // - likewise
ALTER (:a:) // - would change just :a:


HTH
-- 
paolo

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.