3 ms·
Scala! It's mutli paradigm, it can be very simple to read, has amazing concurrency support and can utilize all the NIO goodies from the JVM. Here's an example
by runT1ME 11y ago
Scala! It's mutli paradigm, it can be very simple to read, has amazing concurrency support and can utilize all the NIO goodies from the JVM.
Here's an example of me using it to make multithreaded NIO calls with XMPP:
val conn = Connection.create(getConnParams("username", "password"))
val result =
for {
(conn, myjid) <- ConnectionHelper.gchatConnect(conn, "xmppzExampleClient")
(conn, presence) <- conn.sendGet[Presence](Presence(from=Some(myjid), to=Some(tojid), presenceType=Some("probe")))
conn <- conn.send(Message(body=Some(msgtext), to=tojid, from=Some(myjid)))
conn <- conn.send(StreamEnd())
} yield conn
Each <- is actually an NIO callback that uses a threadpool (so you aren't spawning too many threads).
But you don't get the nested craziness of ugly callbacks like you would in python or javascript (for instance).
Edit: If you really want whitespace, maybe F#?
http://www.tryfsharp.org/ http://www.tryfsharp.org/
- nailer 11y agoMaybe C# or the next release of TypeScript? You'd have asynchronous / await so async IO looks more like regular code than generators. Like Scala though there's still a lot of unnecessary syntax. AFAICT the answer to the parents question is 'No, but this would be good'
- runT1ME 11y agoMy two main languages I work in are C# and Scala. Hands down I prefer the latter. The only pro in the C# column is the fact that Visual Studio is (finally) pretty nice. Otherwise Scala is just better. So much better inference, pattern matching, currying, less syntactic noise, higher kinded types, implicit parameters, etc.
- flippant 11y agoIf you're coming from Python, you will be shocked by the compile times. However, the type system will likely save you time in the long run.