On Jan 6, 10:47 pm, Stephen Compall <[email protected]> wrote:

> (remove-if (curry-after #'find true-inline-fields
>                         :test #'equal :key (compose #'view-field-slot-name
>                                                     #'field-info-field)
>                         :from-end nil)
>            expanded-mixin-fields)
>
> Into code that really does the removal.  FIND doesn't apply the KEY to
> the ITEM argument, only the elements of SEQUENCE.  Fixing this causes
> exactly one test failure:
>
> (deftest get-object-view-fields-7
>     (mapcar #'print-field-info
>             (get-object-view-fields *joe* (defview () (:inherit-from 
> '(:scaffold employee))
>                                             (education :type mixin
>                                                        :view '(data 
> education-history))
>                                             (graduation-year :hidep t))))
>   (name manager university graduation-year))
>
> where the result is (name manager university) instead of the expected.
>
> In r1007:8705a02, Leslie added graduation-year to this list among some
> other fixes.

I can't remember why I did this.

It looks like a confused decision.


> My question is, was your intent to have the mixed-in graduation-year
> field show up (as the test change indicates), or to always shadow
> mixed-in fields (as the earlier changes to factor-overriden-fields
> indicate)?

IMO the correct thing is to honor the more specific declaration and
hide the field.

Mixin fields should be treated on par with non-aggregate fields.


About your patch: it's a lot better than the replaced impl, but I
wonder
whether we can offload the inheritance processing to CLOS instead
of rolling our own with lists?

I haven't sketched out something in detail, but maybe we could have
one method per field per view (expanded from DEFVIEW).

Like:

(defview parent (...)
  (field :hidep t))

(defview child (... :inherit-from parent)
  (field :hidep nil :present-as foo))

=>

(defclass parent-view () ...)
(defclass child-view (parent-view) ...)

(defmethod render-view-field ((view parent-view) (field (eql 'field)))
  ; nothing, we hide the field
)

(defmethod render-view-field ((view child-view) (field (eql 'field)))
  ; delegate to foo-presentation
)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"weblocks" 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/weblocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to