You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if I should classify this as general advice, a bug or a feature request, but here goes:
I've just tried creating an API of nested traits. The reason I wanted this is to avoid having multiple routers on the server side and multiple clients on the client side while still "namespacing" the API and therefore avoid putting all methods in the same trait. I figure it's less messy. Anyway, here's some example code:
traitCalculator {
defadd(a: Int, b: Int):IntdefslowAdd(a: Int, b: Int):Future[Int]
traitMultiplication {
deftimes(a: Int, b: Int):IntdefslowTimes(a: Int, b: Int):Future[Int]
}
defmultiplication:Multiplication
}
objectCalculatorImplextends api.Calculator {
defadd(a: Int, b: Int):Int= a + b
defslowAdd(a: Int, b: Int):Future[Int] =Future.successful(a + b)
objectmultiplicationextendsMultiplication {
defslowTimes(a: Int, b: Int):Future[Int] =Future.successful(a * b)
deftimes(a: Int, b: Int):Int= a * b
}
}
This fails compiling:
[error] /home/alen/projects/skim/jvm/app/controllers/Api.scala:22: api.CalculatorImpl.multiplication.type does not take parameters
[error] val calculator = Server.route[Calculator](CalculatorImpl)
So, the questions here are:
Should I not bother and just have multiple clients for each distinct API?
What is the parameter that is trying to get passed?
Is this a potential feature in the future?
Is this a bug?
Cheers, Alen
The text was updated successfully, but these errors were encountered:
Hi
I'm not sure if I should classify this as general advice, a bug or a feature request, but here goes:
I've just tried creating an API of nested traits. The reason I wanted this is to avoid having multiple routers on the server side and multiple clients on the client side while still "namespacing" the API and therefore avoid putting all methods in the same trait. I figure it's less messy. Anyway, here's some example code:
This fails compiling:
So, the questions here are:
Cheers, Alen
The text was updated successfully, but these errors were encountered: