[Cubicweb] moving and renaming vreg & co

aurélien campéas aurelien.campeas at gmail.com
Thu Sep 15 17:56:37 CEST 2011


2011/9/15 Sylvain Thénault <sylvain.thenault at logilab.fr>

> On 15 septembre 16:33, aurélien campéas wrote:
> > 2011/9/15 Adrien Di Mascio <adrien.dimascio at logilab.fr>
> > > On 15/09/2011 13:27, Sylvain Thénault wrote:
> > >
> > >> After discussing a bit over the phone with Nico, it occured that the
> > >> almost established vocabulary have a problem: in the literature,
> > >> dispatching is about choosing a function or method according to given
> > >> arguments, then to call it with those arguments. In our case, we don't
> > >> do that, but rather pick the most appropriate object according to a
> > >> context, which is then returned to the caller. This is slightly
> different,
> > >> and we're afraid that if the 'dispatch' term is closer to what we
> > >> achieve here, it may also give a wrong feeling on what it does (though
> > >> technically speaking, once an object is selected, it's called with
> > >> the context as argument, but this is usually a class instanciation).
> > >>
> > >> Any thoughs on this?
> > >
> > I see this difference as irrelevant because in practice the returned
> > object's main entry point (method) is called right away (in other words
> and
> > imho cubicweb's appobjects + selectors are actually predicate-based
> generic
> > functions in disguise).
> >
> > Of course we already had a long discussion on this very topic and could
> not
> > come to an agreement. Some people (notably Sylvain) insist on the
> separate
> > object selection (encompassing instantiation) and subsequent usage
> > thereafter as something that bears a specific value (I'm trying not to
> put
> > the wrong words in other people's mouth, please correct me if this is
> > wrong); whereas I see this as an excess implementation detail creeping
> over
> > the underlying predicate dispatch + generic function notion.
>
> And I'm still agreeing with myself after this discussion :)
>
> There are several places where we need this distinction. I can think about
> some places where views have to be manipulated before being rendered, but
> the
>

Can you point to some concrete examples ?


> best exemple is *adapters*: it's common that the API proposed by an adapter
> has several methods, and that we've to get the adapter first, then to call
> various methods there and there.
>

Did someone say callable objects can't return an object ? be a kind of
factory ?

Also maybe this http://www.artima.com/weblogs/viewpost.jsp?thread=155123 can
help a bit understand the relation between adapters and functions (it
certainly helped me).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20110915/e8dd55b3/attachment-0186.html>


More information about the Cubicweb mailing list