-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scala API - please review #51
Conversation
Conflicts: src/main/scala/org/vertx/scala/core/sockjs/SockJSSocket.scala
@Narigo Looking into this, looks very good at first glance :) I'll work on the Scala testtools stuff once I've finished getting Scala scripts to run as well as Scala classes. |
* | ||
* @return The internal type instance. | ||
*/ | ||
def toJava(): InternalType = internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make this package private for org.vertx.scala? This way we'd avoid exposing it to end users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this, actually. We could use it whenever the Java API adds new functionality and needs some Java type...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's more important users don't get somehow attached to the Java API. I'd rather keep it private and if people complain, maybe open it up. The opposite move, having it public and then wanting to make it private it's more problematic. IOW, if it doubt, leave it out. Let's expose as little as possible that gets the job done.
Plus, even if the Java API adds new functionality, we probably wanna wrap it somehow and we probably don't want people to use it as is in the Java world.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in IRC, I'd private[scala] trait VertxWrapper
and let def toJava()
stay public. This way developers can get the internal Java value, if they need it for other APIs (like includeable modules).
/** | ||
* Create a new {@code Pump} with the given {@code ReadStream} and {@code WriteStream} | ||
*/ | ||
def createPump[A <: ReadStream, B <: WriteStream](rs: ReadStream, ws: WriteStream) = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not name these createPump
methods apply
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be consistent with the Java API - I guess that would make it easier for devs coming from other languages to use it. Shall we provide both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for both
Sorry guys, closed by mistake :) |
Here is another batch of additions for the Scala API. We've fixed various bugs and added a lot of tests (thanks @SaschaSchmidt !). Before you ask: Yes, he has signed the Eclipse CLA ;) After we fixed the classloading issues with @purplefox , we have trouble doing the scripting tests. I've added another script to run like the integration_tests scripts from the gradle template, but that didn't work either. Please someone have a look - I have no clue what we'd have to change to get them running again. Thanks for reviewing! |
@raniejade |
Sure thing, I'll check on it right away after I have the time. On Wed, Oct 2, 2013 at 8:49 PM, Joern Bernhardt [email protected]:
Ranie Jade Ramiso w: raniejaderamiso.com |
Did you manage to have a look at the interpreter stuff @raniejade ? |
No, sorry my I'm currently out of the country (business trip, sigh). No On Tue, Oct 15, 2013 at 9:24 AM, Joern Bernhardt
Ranie Jade Ramiso w: raniejaderamiso.com |
i moved it out before we forget it as i guess this might cause trouble later...
tests are still missing, but DnsClient is included now. Next up: Datagram stuff... |
Closing. I've fixed the ScalaInterpreterTest and squashed commits a bit for easier management in #63 |
Everyone, comment on #63 ASAP :) |
FYI @raniejade no need to look at the interpreter stuff any more :) |
Please do not integrate, just review and send me notes about it :)
It should have the complete Java API now, but there are some things
about it:
The event bus is hard to do as handlers which get implicitly
converted create new objects. That means that these new objects won't be
able to be unregistered later. I've added two methods that should be
able to deal with it, but maybe you have a better idea how to handle this.
I've copy & pasted most of the JavaDoc into the Scala stuff. I guess
there'll be some comments that don't work out very well.
I did not implement any(!) tests and actually deleted what was there
before. Mostly because there is no testtools for Scala yet and using the
Java API to test the Scala API is not really nice to do. Is someone
working on testtools already? Would be very nice to use it then and test
everything with it.
As I've done quite a bit of work now during the nights, I'd really like
to see other people working on it - I'd be really happy if someone else
would be able to implement the tests and fix what's wrong with the code.
I'm not sure what would be better: The one posted above or
def doStuff(someParameter: String)(doneHandler: String => Unit)= ...
to beable to call it like this:
doStuff("hello") { answer => println("got a reply: " + answer) }
replacement we could add a real idiomatic RouteMatcher, which might look
like this:
replacement for AsyncResult...? It would also be extremely nice to have
them as a return value of functions, so working with the file system
could look like this:
That's not a good example, but think about "scripting" in this style -
open file, read it, transform it, write the output somewhere else.