[Bug 611] New: Specific Prototypes for collections

View: New views
6 Messages — Rating Filter:   Alert me  

[Bug 611] New: Specific Prototypes for collections

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://helma.org/bugs/show_bug.cgi?id=611

           Summary: Specific Prototypes for collections
           Product: Helma
           Version: CVS trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Database Layer
        AssignedTo: helma-dev@...
        ReportedBy: maksim.lin@...


Currently collections have a Prototype of HopObject.
I would like to (re)propose that instead they be assigned the Prototype type of
the objects that they contain. To me this makes sense as collections are
homogeneous and their type is always explicitly stated in type.properties
declarations.


--
Configure bugmail: http://helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 611] Specific Prototypes for collections

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://helma.org/bugs/show_bug.cgi?id=611





------- Comment #1 from maksim.lin@...  2008-03-28 07:49 -------
Created an attachment (id=87)
 --> (http://helma.org/bugs/attachment.cgi?id=87&action=view)
1 liner patch to implement proposal


--
Configure bugmail: http://helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 611] Specific Prototypes for collections

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://helma.org/bugs/show_bug.cgi?id=611





------- Comment #2 from hannes@...  2008-04-01 12:03 -------
Sorry, this doesn't make sense to me. The prototype of a HopObject defines its
properties, collections, and methods. A collection containing objects of one
type does not automatically implement this type. What's the reasoning behind
this request?


--
Configure bugmail: http://helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 611] Specific Prototypes for collections

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://helma.org/bugs/show_bug.cgi?id=611





------- Comment #3 from maksim.lin@...  2008-04-02 00:38 -------
Sorry should have given a bit more background. I've actually brought this up
before on the mailing list but I wanted to raise it again as I've once again
run into this issue on a couple of projects I'm currently working on.

Basically the reason behind this request is to be able to "call" actions on
collections in order to be able to have actions such as "add", "list", etc on
collections. Currently this is quite cumbersome to do, because collections are
generic HopObjects, so while you can define actions on HopObject that can be
called on a collection, all most all the time what you want is to be able to
have is specific implementations of actions such as "add" and "list" for each
Prototype.
Currently my work-around is to use mountpoints and then have a _children
collection of that Prototype defined in each Prototype,
eg.

Root/type.properties
books = mountPoint(Book)

Book/type.properties
_children = collection(Book)

Book/add.hac
var nuBook = new Book();
//do some processing
this.add(nuBook);

But the more I have used this, the more cumbersome and hacky it has become.

As I mentioned above, because collections are now HopObjects I could just
define actions on HopObject for use with collections, but this will just
pollute the HopObject prototype with actions that bascially have to be have
huge switch statements in order to dispatch to the "correct" method for the
specific prototype contained by that collection.

On reflection, I agree it doesn't seem quite right to assign the Prototype of
its contained elements to the collection, but collections are always of 1 type
(or subtypes of 1 type) as it would be very nice to have a way of defining
actions (and actually methods and maybe even skins) for specific Prototypes.

So perhaps we could instead have a way of declaring prototype for collections,
eg:

BooksCollection/add.hac
var nuBook = new Book();
//do some processing
this.add(nuBook);

and then if the "collection" prototype exists, collections of that prototype
will be assigned this "collection prototype".

Would that be a better approach? It has the benefit of being backwards
compatible. But its just this first alternative I thought of this morning, so
I'm happy for others to suggest other approaches.


--
Configure bugmail: http://helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 611] Specific Prototypes for collections

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://helma.org/bugs/show_bug.cgi?id=611





------- Comment #4 from maksim.lin@...  2008-04-02 08:46 -------
After a bit more thinking on this, I realise what I'm really asking for is a
"declarative" way to assign functions to collections - this can already be done
"in code" by programatically adding action functions to collection objects, but
it would be much nicer to be able to declare them, just like any other action
(ie. in .js or .hac files)
I think my idea initial idea of defining seprate collection prototypes is
actually a bad one, but I can't at the moment think of a nice mechnicsm for
being able to   have a place to put .js and .hac files to be assigned to
Prototype collections.


--
Configure bugmail: http://helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 611] Specific Prototypes for collections

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://helma.org/bugs/show_bug.cgi?id=611


hannes@... changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|1.6.2                       |---




------- Comment #5 from hannes@...  2008-04-07 14:42 -------
I think the way this is usually done is to have two prototypes, e.g. Book and
BookManager, where BookManager is used as mountpoint for a collection of books.
Do you see any problem with this approach?


--
Configure bugmail: http://helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev
LightInTheBox - Buy quality products at wholesale price