Re: Still more strange things ?
Re: Still more strange things ?
- Subject: Re: Still more strange things ?
- From: Deivy Petrescu <email@hidden>
- Date: Wed, 21 Jan 2004 16:11:00 -0500
At 10:38 AM +0100 1/21/04, Jean-Baptiste wrote:
I've encountered the following in a script :
set theArray to {}
repeat 4 times
set end of theArray to theArray
end repeat
--> {{, , , }, {, , , }, {, , , }, {, , , }}
What does it mean ?
++ JB
Well, it means two things.
First you run your script in Smile, because script editor just loops.
Two, that lists (and records) are mutable.
you can try this
set lista to {1,2,3}
set last item of lista to 4
-->lista is {1,2,4}
lista changes to reflect your changes.
So the problem with your script in script editor is the following
set end of lista to lista
it turns lista to {1,2,3,{1,2,3}}
but then it fail to do the end of lista to lista
because it is dynamically assigning lista to
whatever you mutate it to. So actually lista
should be {1,2,3,{1,2,3}, {1,2,3,{1,2,3}}}. But
then, lista should be ...
Mind you that changing lista is
set lista to {1,2,3}
set lista to {4,5,6}
Mutating lista is altering the contents of lista
without changing the pointer, if you will.
Apparently smile can resolve the problem, but not fully.
Each iteration of your loop changes the list in
such a way that mutability prevents it from being
finished.
Basically the command
set end of lista to lista is inconsistent
Because of properties of lista. AS can not resolve that.
smile has a nicer presentation.
Well, done Satimage.
--
Regards
Saudagues
Deivy
http://www.dicas.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.