Ahhhh I got it :) The trick was where Lukas said: readSymbol "PRIVATE -- Read the contents of a Symbol." ^ self readString asSymbol but....I realised that, String >> asSymbol is: asSymbol "Answer the unique Symbol whose characters are the characters of the string." ^Symbol intern: self And...Symbol >> intern: intern: aStringOrSymbol ^(self lookup: aStringOrSymbol) ifNil:[ | aClass aSymbol | aStringOrSymbol isSymbol ifTrue:[ aSymbol := aStringOrSymbol. ] ifFalse:[ aClass := aStringOrSymbol isOctetString ifTrue:[ByteSymbol] ifFalse:[WideSymbol]. aSymbol := aClass basicNew: aStringOrSymbol size. aSymbol string: aStringOrSymbol. ]. NewSymbols add: aSymbol. aSymbol]. that's why I don't get duplicates!!! Thanks a lot Lukas and Adrian...each day I am understanding a bit more all this stuff :) Cheers Mariano On Thu, Jan 21, 2010 at 9:31 PM, Mariano Martinez Peck < marianopeck@gmail.com> wrote:
On Thu, Jan 21, 2010 at 9:26 PM, Lukas Renggli <renggli@gmail.com> wrote:
Any ideas where this black magic comes from ?
From what I know Symbols always end up in the out-pointers because they are always referenced at least from the Symbol table.
Not necessarily. The symbol table is a *weak* set and hence if you don't strongly hold onto the symbols they get into the segment array and not into the out pointers! This is a potential source of subtle problems because after loading the segment you end up with duplicated symbols (we run into this with Cmsbox...). The easiest solution is to create a temporary variable and assign "Symbol allSymbols" while creating a segment.
Ok, but that is done at several places in ImageSegement.
I "fixed" this. Actually, I don't fix it, but I put in at least only one place that fix for everybody (I think).
Thanks for the tipo of ReferenceStream>>#readSymbol. however...I debug it and have empy symbols...wierd. Now I am very dead, but I hope tomorrow to check it more in depth.
Lukas
-- Lukas Renggli http://www.lukas-renggli.ch
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project