Glue classes proposal 0.9

Jeremy Manson jeremy.manson at gmail.com
Sun Mar 22 22:10:51 PDT 2009


I believe that what Marek is trying to do is to introduce a feature
that allows you to add (or glue) methods to existing classes.  You
could have, for example:

// Glue class to add sorting to Lists
class Sort<T> glue(List<T>) {
  void sort(List<T> l) {
    // sorts the argument
  }
}

And then later say:

List<Integer> list = new ArrayList<Integer>();
// adds elements to list
list..sort();  // The ".." notation invokes Sort.sort() on list.

It seems like rather a large change to me, and is along the same lines
as some other proposals that have been rejected as out of scope.  But
perhaps Joe thinks otherwise.

Jeremy

2009/3/22 Tim Peierls <tim at peierls.net>:
> On Sun, Mar 22, 2009 at 7:27 PM, Marek Kozieł <develop4lasu at gmail.com>wrote:
>
>> >> Let's say, we write sample program doing something...
>> >> Part 1 (we have already some glue classes defined)
>> >
>> > I [Tim] couldn't get past this point. What's a glue class?
>>
>> At start, think about it as classes responsible for adding new methods to
>> existing types.
>>
>
> I'm completely baffled by all of this.
>
> --tim
>
>



More information about the coin-dev mailing list