Simplifying apply method

Hello guys and gals.
I am building an Atom Library using Daniel Spiewak's anti-xml. 
I have built an extension mechanism using the trait found here https://github.com/arktekk/scala-atom/blob/master/src/main/scala/no/arktekk/atom/extension/AtomExtension.scala
The problem is that when I want to compose multiple Extensions the signature kind of explodes.
Is there a more general way to do this?

Best regards
Erlend

PS: I have looked at HList, which will probably work.

Re: Simplifying apply method

In situations like this, I write a code generator, not the code itself.  It's usually pretty easy (except possibly for the build process--depends on your build tool of choice, I guess).
  --Rex

P.S. Most obvious version would go something like:
"def apply[Like,"+types.mkString(", ")+"]("+
types.map(t => t.toLowerCase + ": AtomExtension[Like,"+t+"]").mkString(", ")+
"): AtomExtension[Like,("+types.mkString(", ")+")] = new AtomExtension[Like, "...
but search-and-replace on tokens you leave behind works well also.



On Fri, Jan 13, 2012 at 3:46 AM, Erlend Hamnaberg <ngarthl [at] gmail [dot] com> wrote:
Hello guys and gals.
I am building an Atom Library using Daniel Spiewak's anti-xml. 
I have built an extension mechanism using the trait found here https://github.com/arktekk/scala-atom/blob/master/src/main/scala/no/arktekk/atom/extension/AtomExtension.scala
The problem is that when I want to compose multiple Extensions the signature kind of explodes.
Is there a more general way to do this?

Best regards
Erlend

PS: I have looked at HList, which will probably work.

Copyright © 2013 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland