It seems my question catalyzed quite a discussion!  Thank you all for
weighing in.  I certainly understand more of the underlying
architecture that makes these "sugary" things possible in web2py and
other frameworks.

Just to clarify, Massimo; in order to use this type of "generic" in
web2py, I am essentially keeping a "master table" ('user', in your
example) referring to other records of different types.  This means
that each object I create I have to make sure to insert a record into
the 'user' table.  When that object is removed, I also have to remove
its reference from the 'user' table to keep it clean.  Correct?

On Sep 6, 7:10 pm, Yarko Tymciurak <[email protected]> wrote:
> @Joe -
>
> You are jumping ahead --- the point of appropriate abstractions is to
> specify what _kind of_ thing you are doinng, so in the future, when new uses
> arise, users do not need to adjust (e.g. site writers) - only the underlying
> implementation need change.
>
> @Massimo -
>
> while you "can do this" using integer, it misses the point of appropriate
> abstraction.  It is not at all about what "web2py" knows;  it is what the
> programmers using the framework know and read.   (integers are
> implementation specific, and as an abstraction for this use are useless -
> integers are useful for MANY _kinds of_ things, and for this use, their use
> if obtuse in that it masks what intent and use is).
>
> If you want web2py to "look" (to programmers) like it supports generic
> references (it does) then the language should represent that. Otherwise, you
> are relegated to implementation details and questions of "how do I do
> _this_  _kind of thing_  in this framework - you do not want to be
> replicating implementation details at every programmer - whenever possible,
> it should be self-evident; this is one of thse cases where that improvement
> could be made.
>
> - Yarko
>
> On Sun, Sep 6, 2009 at 5:43 PM, mdipierro <[email protected]> wrote:
>
> > There are oranges and there are apples.
>
> > oranges are arbitrary foreign keys. The problem here is not
> > implementing them in the DAL. this could be done in a couple of lines
> > of code. The problem is 1) is this good practice? I think no. 2) how
> > should SQLFORMs handle this?
>
> > apples are "polymorphic references". You can do this using "integer".
> > I do not see the need for defining another keyword unless you want to
> > make web2py aware that this integer contains a polymorphic reference.
> > Assuming this were possible (and it is not in an easy way), what would
> > you like the DAL to do with it?
>
> > Massimo
>
> > On Sep 6, 5:02 pm, Joe Barnhart <[email protected]> wrote:
> > > OK, I'm confused.  Are you suggesting that "reference generic" should be
> > an
> > > alias for "integer" or that it should be smarter and permit UUIDs and
> > other
> > > structures?  Is this a beginning of a "foreign key" concept for web2py?
> > > That might have some pretty extensive usefulness...
>
> > > On Sun, Sep 6, 2009 at 12:49 PM, Yarko Tymciurak <[email protected]>
> > wrote:
>
> > > > On Sun, Sep 6, 2009 at 2:45 PM, Joe Barnhart <[email protected]
> > >wrote:
>
> > > >> I am not against sugary goodness in general, but this seems like
> > something
> > > >> that might be better handled with education rather than overlaying the
> > name
> > > >> "integer" with "reference genric".  (Besides, then what would you do
> > with
> > > >> people who wanted to use UUIDs for their "reference generics" instead
> > of
> > > >> integers?)
>
> > > > ... that is my point - why educate on integers, when that's not good
> > > > education;  hide the implementation into a logical abstraction (generic
> > > > reference term just being borrowed from Matthew's post).
>
> > > > Your point about UUIDs sounds more like an agrument _against_ teaching
> > > > about integers than anything else, to me at least...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to