> I think I understand what you are saying, but I just want to make
> sure. You are saying that instead of trying to define a view for the
> datalist widget to display the list how I want, it would probably be
> easier to just write my own list widget that has a render-widget-body
> that does what I want? But doesn't this make the code somewhat
> redundant/break the abstraction of views from widgets? Why even have
> views as a feature in the language?
Your comments are spot on.
Views are a good idea, but IMHO in the current implementation they
aren't that useful. I think the problem is that they try to do too
much -- instead of just being a mapping from the data model to widgets,
they also implement some of the widget functionality (like rendering),
some controller functionality (form processing), but they aren't really
first-class citizens.
My idea to fix this is roughly as follows:
1) make presentations be widgets, with an additional presentation
interface,
2) reduce views to maps between data model and presentations,
3) make views usable only from widgets (e.g. you have to use formview or
something similar, you can't just call render-object-view.
That way presentations would be first-class citizens (with dom-ids,
being on the children list, etc) and could participate in flows. Views
could still be stateless data maps, as (I think) they were intended to
be. And they could be instantiated as many times as one wishes. Plus, we
could keep the existing view infrastructure: view combining,
inheritance, scaffolding.
Comments welcome. I began working on this, but progress has been slow so
far.
--J.
> On Feb 17, 12:32 pm, Jan Rychter <j...@rychter.com> wrote:
>
>> My idea to fix this is roughly as follows:
>>
>> 1) make presentations be widgets, with an additional presentation
>> interface,
>> 2) reduce views to maps between data model and presentations,
>> 3) make views usable only from widgets (e.g. you have to use formview or
>> something similar, you can't just call render-object-view.
>
> Very good. We would also need to have something akin to a parser-
> mixin, though, since there's a need to merge presentations and parsers
> in some situations (think maximum length on text fields for example).
You're right about the need, but I'm not sure about the solution. I
don't know what the presentation/parser interface to widgets should look
like yet.
> It doesn't sound like a lot of work, actually.
My estimate is about 3-4 days of work.
> Could you perhaps publish what you've got so far?
I am afraid I don't have much to show yet. Once I do, I'll create a new
topic branch in my tree.
--J.
Very good! I suggest we postpone the merge of your other changes
until later then; the views overhaul is more important.
[catching up with a huge backlog]
No, I didn't actually do anything on that front, apart from some
discussions with Saikat. He seems to have a good design planned, so I'll
be waiting for his work.
--J.