[Laszlo-user] overridding core class by inclusion

Henry Minsky henry.minsky at gmail.com
Tue Jul 10 18:42:24 PDT 2007


I should add that there is a certain magic translation of core class names
from LZX to Javascript that is happening, so <view> actually corresponds to
the real class named LzView, same for most of the core classes that are
user visible. The magic happens via the static var declaration in a class
called "tagname":

class LzView extends LzNode {
static var tagname = 'view';
..


As Tucker said, if you redefine a core class like that, you do so at your
own risk,
all sorts of things will probably break.

On 7/10/07, P T Withington <ptw at openlaszlo.org> wrote:
>
> Welcome to dynamic languages.  Yes, it is allowed.  If you really
> wanted to, you could replace the core classes too.  And, yes, it will
> probably cause a problem if you do.
>
> In general, Javascript emphasizes flexibility over safety.  IMO, Java
> leans the other way.
>
> On 2007-07-10, at 13:29 EDT, Pierre Augier wrote:
>
> > I all !!
> >
> > i 'am asking if it's possible to override core class by inclusion
> >
> > i mean something like this :
> > ----------------------------------------------------
> >
> > #file /mypath/view.lzx
> >
> > <class name="view">
> >
> > // my own view class
> >
> > </class>
> >
> >
> > and later...
> >
> > #file /myotherpath/myapp.lzx
> >
> > <include href="/mypath/view.lzx"/>
> >
> > <canvas>
> >
> > <!-- use of the overrided class -->
> >    <view name="lalala" />
> >
> > </canvas>
> >
> > ----------------------------------------------------
> >
> > I've tried with "view" and "text" as class name     ==>     does
> > not work (compilation error)
> > then i've tried with "menu" or "button"                 ==>     it
> > work althought i get a warning message in debug console
> >
> > i guess it's because view and text are in the LFC, but menu and
> > button are component ...
> >
> > but my question is:
> >
> > except for LFC that sems impossible to override, for the other
> > class, is this allowed ?? will cause problem ???
> >
> >
> > thanks
> >
> > Pierre
> >
> >
>
>


-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-user/attachments/20070710/01f22dff/attachment.html


More information about the Laszlo-user mailing list