Subject: [[email-masked]: Re: Zero Memory Widget Library]

From: "Nadav Har'El" <[email-masked]>
Date: Mon, 5 Jan 2004 16:05:27 +0200

This was sent to me, I think it was meant for the whole list:

----- Forwarded message from thierryexcoffier <[email-masked]> -----
Date: Mon, 05 Jan 2004 12:07:10 -0000
From: "thierryexcoffier" <[email-masked]>
To: [email-masked]
Subject: Re: Zero Memory Widget Library

--- In [email-masked], guy keren <choo@a...> wrote:
> 
> On Mon, 15 Dec 2003, Shlomi Fish wrote:
> 
> > Spotted on Freshmeat: the Zero Memory Widget Library:
> >
> > http://www710.univ-lyon1.fr/~exco/ZMW/
> >
> > A GUI library whose widgets are claimed to occupy a zero amount of
memory.
> > I did not quite understand how it works, but you may find it
interesting.
> 
> it's a fraud. it uses one global 'zmw' variable to hold what i would
call
> "the zmw root window", and uses it to point to a tree of widgets. so
zero
> memory? not realy.

I am the author of the library.
Let me give some explanations.

The library does not store the widget tree.
There is really no memory used PER widget.
The 'zmw' variable contains a stack of widgets, so the
size required by the stack is proportionnal to
the widget tree depth.
The stack is used only when the virtual widget tree is traversed.

> and they also require the user to allocate memory, when there is a need
> for dynamic memory usage.

Most of the time the memory had yet been allocated.
For example if you want a text entry from the user:
With a classic library:
  - You create the widget.
  - You initialize the initial content.
  - On user validation, you copy widget text content in application.
  - If the application modifies the text, the widget must be updated
With ZMW:
  - Your application initialize text content.
  - You define the widget editing the content.
  - The user and the application modify content,
    there nothing to do to synchronize values.

So, with the classic library the memory for the text content
is used in the application and in the widget.
With ZMW, the text content is only in the application.

> and you need to use static variables in various functions to get
over this

Static variable are used to simplify the examples.

> odd library's limitations - which means at most one instance of a widget
> defined by a given variable. or will you find a way to overcome this
> limitation?

If you have a real application, static variable are not needed
the widgets automaticaly update applications data.

And another nice feature, it is possible to use the
same data for several widgets.
So it is trivial to have synchronized toggles or text entry
in the GUI.

If you want more informations on how it works, you can
take a look to:

http://www710.univ-lyon1.fr/~exco/ZMW/rr_2003_03_11.pdf

Sincerely yours and happy year.

----- End forwarded message -----

-- 
Nadav Har'El                        |        Monday, Jan 5 2004, 11 Tevet 5764
[email-masked]             |-----------------------------------------
Phone: +972-53-790466, ICQ 13349191 |If Windows is the answer, you didn't
http://nadav.harel.org.il           |understand the question.