4 ms·
This is what's frustrating about being a Tcl fan: Tcl had this something like 15 years ago, because it was necessary for Tk. "Tcl don't get no respect" :-/ Th
by davidw 17y ago
This is what's frustrating about being a Tcl fan: Tcl had this something like 15 years ago, because it was necessary for Tk. "Tcl don't get no respect" :-/
That said, though, what separates the "men from the Erlangs" is that in Tcl, Ruby, Python, Javascript, and company, "never block the reactor" is the name of the game, you can't do a while { 1 } { something } in your event handler or it will wedge the whole thing.
In Erlang, thanks to its built in scheduler, you can.
- tptacek 17y agoLook more closely at Ruby. It's Japanese [incr tcl].
- davidw 17y agoRuby's OO is nicer than Tcl's in some ways. Incr Tcl is sort of an ugly attempt to make Tcl look a bit like C++. Indeed, the Tcl core team came up with their own OO thing recently, that actually looks a bit more like Tcl: http://wiki.tcl.tk/18152 http://wiki.tcl.tk/18152
- viraptor 17y agoWhat always bugged me about Twisted, or similar design is that you have to really flex your brain to get proper error handling (or maybe I'm just not experienced enough with them? :) please correct me if I'm wrong) It seems that you need a lot of shared state to kill some other process that is connected to your action in some way... You need to set a flag that will stop the other code path in some place. Then you need to know how to resolve the conflict (is one process providing resources for the other one? how do you synchronise closing down?) In Erlang (or a similar multiprocess / actor-based system) you just kill the computation you want to stop. It's up to the killed side (or their supervisor) to know how to handle it - but it doesn't happen during the next computation loop, or when it's convenient - it handles the condition now.
- deleted 17y ago[deleted]
- rubyrescue 17y agoshould it be "the Erlangs from the eventboys"?
- axod 17y agoWhy is that a good thing? Essentially what you're saying is that Erlang allows you to make idiotic mistakes?
- davidw 17y agoIf the logic of your program is: On event, do some big, long calculation. Why should you need to write the code differently from that? It's nice that the language/environment handles things for you, rather than manually dividing things up into little chunks.
- axod 17y agoIf your program is: Show a calculator. Why should you need to write the code to do each individual part of the calculator? I disagree, dividing up the work yourself into chunks means you retain complete control of when your code executes. That actually decreases the complexity of your code, since you know when everything will execute.
- jerf 17y agoNo. Things that are not Erlang turn you into a human compiler, forced to manually chop your code into pieces for the pleasure of the computer. Erlang allows you to actually write things without doing the chopping up the scheduler should do. Event-based libraries are great hacks on top of weak languages/runtimes that allow those weak languages to hobble forward into the present, but they shouldn't be confused for the right approach in the future. I do hope they don't become trendy. Of course, look for them to become trendy, then for one or more of them to rediscover the pleasure of actually writing code in a straightforward manner, so they will provide you with a preprocessor that tries to do the chopping up for you, but still won't solve the problem of doing too much work in one timeslice. Then they'll rediscover that cooperative multitasking was abandoned years ago for good reason. You know, there's nothing new under the sun, but sometimes you just wonder... this much hype around cooperative multitasking? Seriously?
- axod 17y agoI can't disagree with you enough. I don't want anything else to decide what order my code runs. I want it to run in the order I decide. Once you move away from the stupid "I want these 100 things to run at the same time", and realize that's impossible unless you have 100 CPUs, then you can start to move forwards and learn a better way. Event based / async programming is simple once you get used to it, it's hugely liberating, and _extremely_ efficient. It reduces code complexity, and means you _know_ what order your code will execute in. Something that I kinda like knowing.
- BrianHammond 17y agoI learned Tcl back in college (say 15 years ago) and have not used it since. However, while investigating things like EM and Twisted, I for some reason thought of Tcl. I (and others [1]) asked on the Tcl mailing list about creating a "C10K" server in Tcl but unfortunately Tcl does not have support for epoll, kqueue, etc. at this time. [1] http://aspn.activestate.com/ASPN/Mail/Message/tcl-core/3750934 http://aspn.activestate.com/ASPN/Mail/Message/tcl-core/37509...