[Etoys] type clash in viewer slots

Scott Wallace scott.wallace at squeakland.org
Fri Jun 6 16:56:08 EDT 2008


On Jun 6, 2008, at 4:20 AM, K. K. Subramaniam wrote:

> On Friday 06 Jun 2008 2:13:05 pm Scott Wallace wrote:
>> Thus, in your example, you might decide to call that getter "getDPI",
>> and hence make the slot-declaration be something like:
>>
>>    (slot resolution 'Resolution in dots per inch' Number Player
>> getDPI Player setResolution:)
> This is what I did. But that still leaves the possibility of  
> conflict open.
> The viewer code doesn't report the conflict but simply picks up the  
> first
> type in the list. The blowup happens only when the affected morph is  
> opened.


The "getter" is the *sixth* item in the viewer spec, "getDPI", not the  
second item, "resolution".  The thing that needs to be unique is that  
sixth item.  If you make that unique, you'll find that the types do  
not stomp on each other and that everything works as you'd hope.

Please see the attached fileout for a fully-worked example where the  
same slot-name is made to be associated with different types in  
different morphs.  In this example, a numeric slot "xxx" is added to  
the digital clock (ClockMorph) and a color-valued slot of the same  
name, "xxx", is added to TextMorph.  Both are visible in the "basic"  
categories of their respective morphs.


   -- Scott


-------------- next part --------------
A non-text attachment was scrubbed...
Name: slotTypeExample-sw.1.cs.gz
Type: application/x-gzip
Size: 1258 bytes
Desc: not available
Url : http://lists.laptop.org/pipermail/etoys/attachments/20080606/19b74d0e/attachment.bin 
-------------- next part --------------



More information about the Etoys mailing list