Re: Local / lazy referencing

Charles Goodwin <[email protected]> Thu, 09 Oct 2003 12:41:59 +0100
Newsgroups gmane.comp.java.xwt.widgets
Organization XWT Foundation
Message-ID <[email protected]>
Adam Megacz wrote:
> Er, how else are you going to access resources?

The thing that bugs me about this is that you will access box properties 
far more frequently than you will resources, especially in the widget 
libraries.  And having to access arbitrary box properties through 
'thisbox.' when thisbox is seemingly the scope (for normal box 
properties) just seem unintuitive.

As ever, I'd work around it if I have no other option, but I really feel 
that this is inconveniencing the XWT developer.

Would it not be better to specify an arbitrary way of accessing 
resources?  Perhaps by perpending something initially - like 'res.'?

thisbox.image = res.org.xwt.theme.monopoly.image["test.png"];

Given 1) how infrequently you'll use resources compared to box 
properties and 2) how long a resource reference tends to be anyway, it 
would be far easier from the XWT developer perspective to use something 
like that.

I dunno, I'm frequently wrong when it comes to these things (as the past 
has well proven) and you and the other core developers usually make wise 
decisions.  I just don't 'feel' this is best when it comes to teaching 
people XWT.

What is easier to absorb for the uninitiated:

  o  Resources (which are special), xwt-defined box properties, and var
     variables all share the same scope, whilst custom box properties
     must be accessed in a special way with 'thisbox.'

  o  All box properties (normal and custom) and var variables all share
     the same scope.  Resources (which are special) must be accessed in
     a special way with 'res.'

Making resources distinct from variables and all box properties is much 
easier to absorb than mingling resources with variables and xwt-defined 
box properties and having custom box properties distinct.

Not intended to be patronising; remember the target audience as well as 
the convenience of the core.

- Charlie