Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2818

Either support true stateful mixins or remove the current experimental implementation all together

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.6-beta-1
    • 1.6-beta-2, 1.6-rc-1, 1.6-rc-2
    • syntax
    • None

    Description

      The current implementation of mixin requires the target type to be the first argument:

      IntegerMixin {
          Integer crazyPlus(Integer self, Integer other) { self - other }
      }
      

      This is ugly. We need to change it to support true mixins where we change the meaning of "this" to refer to the object:

      IntegerMixin {
          Integer crazyPlus(Integer other) { this - other }
      }
      

      You should also be allowed to store state in the IntegerMixin class so that mixins can be stateful

      Attachments

        Activity

          People

            ait Alex Tkachman
            graemerocher Graeme Rocher
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: