- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Simplifying apply method
Fri, 2012-01-13, 09:46
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.
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.
--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@gmail.com> wrote: