Arc Forumnew | comments | leaders | submitlogin
2 points by skenney26 5839 days ago | link | parent

I've been thinking it might be possible to make these mappings implicit. Imagine you had a version of deftem (I'll call it defitem) that inspected the fields in your templates:

  (defitem post
    id     nil
    title  nil
    text   nil
    tags   nil)

  (defitem tag
    id     nil
    text   nil
    post   nil)
defitem would see that post has a relationship with tag and tag has a relationship with post by looking at the names of the fields in each template. Since the post field in tag is singular and the tags field in post in plural, it would know that there is a one-to-many relationship between post and tag. Then defitem could create any necessary accessor methods.

Anyways, that's what I've been attempting recently.