[Dev] CPIA refactoring: eliminating blockName?

John Anderson john at osafoundation.org
Thu Dec 1 17:09:37 PST 2005



Alec Flett wrote:

> John Anderson wrote:
>
>> itsName gets turned into something useless when a block gets copied 
>> to the soup, BlockName doesn't, so we should always be using BlockName.
>>
> So this explains the technical details of HOW blockName works, but it 
> doesn't really answer my question: WHY do we actually need a 
> blockName? I guess my question is if findBlockByName() itself can be 
> eliminated by just using direct references to blocks rather than 
> storing blockNames, do we need blockNames at all?

We started out with references and still use them in a bunch of cases 
like the way you propose. But that broke when blocks were copied and 
also trees come and go. Scripts also needed to refer to blocks and 
couldn't use references.

>
> i.e. instead of
> Block.update(parcel, "foo", blockName="foo")
> BlockEvent.update(parcel, "fooEvent", blockName="fooEvent",    
>                        dispatchEnum="SendToBlockByName",
>                        destinationBlockName="foo")
>
> how about
>
> foo = Block.update(parcel, "foo")
> BlockEvent.update(parcel, "fooEvent",
>                        dispatchEnum="SendToBlockByReference",
>                        destinationBlockReference=foo)
>
> and instead of
> block = Block.findBlockByName("foo")
> why not some variant on
> block = schema.ns(cpiaView).foo?
>
> If having human-readable names in the soup is important, I can think 
> of cleaner solutions there too... for instance what if we created 
> //userdata/activeView/ and then when we copied stuff into the soup, 
> then we'd put it in the full parcel/itsName, i.e.

I don't think human-readable names is the thing that motivated 
BlockNames. It was, as Bryan mentioned, more than  itsName needs to be 
unique in a repository directory.

>
> //userdata/activeView/osaf.views.main.SideBar
>
> This is all hinged on being able to actually eliminate findBlockByName 
> though. That's really what I'm getting at...
>
> Alec
>
>> Alec Flett wrote:
>>
>>> Working on the ZaoBao tutorial, and trying to explain the difference 
>>> between a Block's blockName and its itsName, I'm starting to wonder: 
>>> why do we have both?
>>>
>>> I came up with two reasons:
>>> - easy referencing/lookup of blocks by name.
>>>   But schema.ns() provides easy access to any well-known object by name.
>>> - event dispatching - to dispatch to an event with a given name.
>>>   But again, schema.ns provides easy access.. and besides I think in 
>>> many cases I think we'd be better off just using 
>>> SendToBlockByReference and just directly referencing the block.
>>>
>>> Thoughts? I can see how blockName was useful at one point, but I 
>>> think now its purpose has been superceded by schema.ns().
>>>
>>> Alec
>>>
>>>------------------------------------------------------------------------
>>>
>>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>>
>>>Open Source Applications Foundation "Dev" mailing list
>>>http://lists.osafoundation.org/mailman/listinfo/dev
>>>  
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osafoundation.org/pipermail/dev/attachments/20051201/b497a767/attachment.htm


More information about the Dev mailing list