4 ms·
I'm interested in the independent opinions. I hope to see more of them going forward. Here is my relatively uninformed opinion based on having read through th
by btilly 17y ago
I'm interested in the independent opinions. I hope to see more of them going forward.
Here is my relatively uninformed opinion based on having read through their examples and some of the recent discussion.
Having looked at the language a little, I think I understand why they don't have exceptions yet (if ever). The problem is that they envision using this to write servers, and the servers will essentially use a microkernel design with message passing through channels. But when one of your little miniservers goes down, who is it supposed to report the error to and how will that be dealt with? If there is no good answer, then what sense does it make to let a miniserver go down without warning?
To be concrete, take this example from the documentation:
func startServer(op binOp) (service chan *request, quit chan bool) {
service = make(chan *request);
quit = make(chan bool);
go server(op, service, quit);
return service, quit;
}
If an exception is thrown within the server function, who catches it? What can startServer do? Someone who talked to chan? The last process who tried to talk to chan? Everyone who tries to talk to chan? Do we shut down the whole program? Concurrency gives you tangled flow of controls, and you don't have a simple stack where it is clear who has responsibility for a given error. In some ways it really does make sense for the server to pass back an error object somewhere and let someone else figure out what to do about it.
Moving on, I think a better mental model for "interface" is "implicitly matched mixin". Like a Ruby mixin and unlike a Java interface, once you've matched the set of methods in the interface you can now call the methods that are appropriate for that interface. That's very powerful, and potentially very dangerous. When you write a larger system I could definitely see method name collisions becoming a big deal.
Moving on, the lack of generics is huge, and I hope they solve it. They have first class functions and closures, but when asked on the mailing list whether they support standard functional goodness like map and reduce, the response was that the type system made that really hard. When I think about it, I can understand why they are fighting the type system. But if they can add generics then they can solve that problem. The challenge is doing it efficiently.
And my final thought is that anyone thinking of building a real server out of this should read up on capability systems before figuring out their security/permissions model. I say this because having a channel to a service IS a capability, but most programmers don't realize how powerful that organizational concept can be. If you think that you're among them, http://www.eros-os.org/essays/capintro.html http://www.eros-os.org/essays/capintro.html provides a good introduction.
- jerf 17y ago"But when one of your little miniservers goes down, who is it supposed to report the error to and how will that be dealt with? If there is no good answer, then what sense does it make to let a miniserver go down without warning?" Answer: http://www.erlang.org/doc/design_principles/des_princ.html#1.1 http://www.erlang.org/doc/design_principles/des_princ.html#1... . You send the error to the supervisor. Go strikes me as less C++ meets Python than C meets Erlang, but Go has the C side covered better than the Erlang side so far. If Go "steals" the OTP framework, and especially if channels grow the ability to span across different nodes, Google will definitely have something interesting (to me).
- uriel 17y ago> if channels grow the ability to span across different nodes This is being considered, rob said he has been thinking a lot about it, but obviously they want to get something as important right.
- jerf 17y agoAbsolutely, by all means, take the time to get it right. I don't know if I'm saying something blindingly obvious or not, but it still should be said just in case: The team really needs someone who has not just glanced at Erlang tutorials, but actually used it for significant work. Not necessarily "hired", but certainly in the loop. The Erlang community could tell you a lot about what works, and give you a few things that don't work in Erlang well either. OTP is killer for reliable server apps, but it's really hard to understand the full implications until you've used it yourself for a while. Implementing cheap threads is great, but there's a couple more primitives to grab that make it truly powerful. I am advocating this because as much as I like Erlang, I'd really love to see another language steal its thunder. The syntax and performance are dubious (not terrible, but not stellar). But while I've seen other languages implement bits and pieces of the whole, I'm yet to see another community grok the totality of the Erlang platform and correctly port it into their language, often because they're trying to graft something into their language that it just can't support. Go is probably not in that position, and is my best hope for this sort of thing.
- 17y ago