Magma + Form objects ?

Chris Muller chris at funkyobjects.org
Mon Oct 9 02:24:12 UTC 2006


Hi Hilaire, thanks for the great question.  When this code

> (maSession root at: 'test')

runs it returns a Dictionary composed as follows:

  'test' -> aForm

and aForm is composed as:

aForm
  bits = ***aMaMutatingProxy***
  width = someInteger
  height = someInteger
  depth = someInteger
  offset = aPoint

aForm is then sent: 

  #display 

which ends up comparing the 'bits' with an inlined message, or using
the 'bits' as an argument to a primitive (I dind't take the trouble to
discover which).

So a ReadStrategy is needed to materialize Forms / BitMaps:

> maSession := MagmaSession openLocal: '/home/hilaire/MagmaDB'.
> maSession connectAs: 'hilaire'.
"*** add this code ***"
maSession readStrategy:
	((MaReadStrategy minimumDepth: 1)
		onAny: Form readToDepth: 999 ;
		yourself).
> (maSession root at: 'test') display

ReadStrategy's are critical to using Magma.  They are used for 1)
optimizing performance, 2) ensuring any MagmaProxy is never sent an
inlined message (like ==) or 3) ensuring any MagmaProxy is never an
argument to a primitive.

So why was the 'offset' a Point instead of a Proxy?  Because, if you
look at MaReadStrategy>>#initializeDefaultSpecifications, you will see
that Point, among several other classes, is part of the default
ReadStrategy to read 99 levels deep.  

For the next release I will add BitMap and Form to this list as well so
you don't have to put them into your own ReadStrategy in the future.

Thanks for finding this..!

 - Chris



--- Hilaire Fernandes <hilaire2006 at laposte.net> wrote:

> I got this odd problem when persisting From instances.
> 
> When I do the following:
> 
> --
> maSession := MagmaSession openLocal: '/home/hilaire/MagmaDB'.
> maSession connectAs: 'hilaire'
> 
> maSession commit:
>   [maSession root at: 'test' put: ((WatchMorph new imageFormDepth:
> 16)].
> maSession disconnect;closeRepository
> --
> 
> Then when I quit Squeak (without saving the image) and start it again
> and do:
> 
> --
> maSession := MagmaSession openLocal: '/home/hilaire/MagmaDB'.
> maSession connectAs: 'hilaire'
> (maSession root at: 'test') display
> --
> 
> I got an error message from the BitBlt>>copyBits:
> 
> Bad BitBlt arg (Fraction?); proceed to convert.
> 
> After proceeding, it is display fine.
> 
> Inspecting the Form does not reveal anything special.
> 
> Any tips about this problem?
> 
> Hilaire
> 
> 
> 
> 
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
> 
> 
> 



More information about the Magma mailing list