#2129 Mixins - 'adding' methods to an existing class?

pjl Fri 5 Apr 2013

What is the idiomatic Fantom way to add new functionality to existing classes? For example, if I wanted a minMax method for List, what would be the best/standard way?

  • I noticed some of the pods on http://repo.status302.com/ do the Java thing of adding a FooUtils class with static methods.
  • Also, it doesn't look like mixins will work for this. From the documentation for mixins it appears they are interfaces + implementation. (That is, they are not like Ruby mixins, where you open the class and add methods.)

andy Fri 5 Apr 2013

Fantom doesn't support anything like extension methods right now. Typically I go the static method route on a utility class.

Login or Signup to reply.