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?

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.

//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



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev

Reply via email to