7 ms·
Tcl.js: robust, high-performance Tcl in JavaScript
- sdegutis 11y agoTcl's got a pretty bad rap. But you know what? It probably deserves it. Anyway, well done, it's nice to see things ported to JS since JS has overtaken both math and love as the universal language.
- fuck_dang 11y agoAsync to the core in the 90s? Extremely expressive, rivaling Smalltalk? Small, understandable core with simple semantics? Teachable to newbies in hours rather than weeks? Yup, definitely deserves it. /s
- ktRolster 11y agoThe extremely simple syntax is underrated. When you are writing code in a language, at some level you have to parse it in your mind, to make sure the compiler will accept it. When I first came across TCL after years of writing C++, I couldn't believe how much lighter the mental load was (I hadn't even noticed it until then).
- fuck_dang 11y agoI don't even play around with TCL anymore, but I've been writing Ruby for a few years, and it's been a good time. The syntax isn't dense enough to block out the constructs, I guess. Anyways, I was looking at Dart a while back, and sat down in my editor and started working and quickly realized that I hold the entire program in my head but had to keep checking a cheat sheet for syntax. There's definitely something to be said for languages or tools that can alleviate that blockage. I guess it's the level of abstraction more than anything. TCL is really neat and being that the syntax IS the code, like Lisp, there's really no difference between how a solution works in your head and how it has to be written in the editor. So yeah. TCL's pretty dope.
- ktRolster 11y agoIf you're going to insult a language, you should at least say WHY you don't like it.
- keepitsmall 11y agoOusterhout designed Tcl as a general replacement for the kind of small crappy one-off interpreters he found himself adding to larger systems over and over again. At one point he decided that enough was enough and we was going to write an embeddable interpreter with the flavor of a simple shell like bash. Tcl is great for simple scripting and automated testing. It's also great when you want to represent small bits of data as code. Perspecta Presents[1], one of Ousterhout's first commercial ventures, used Tcl scripts as the file format for its presentations[2]. But Tcl was never intended for large programs. Ousterhout expected large programs to be written in another language with compilers, linkers, linters and other tools. Once a Tcl program gets past a certain size it becomes effectively unmaintable. Tracking down a variable name typo bug in a 100,000 line Tcl program is a hell I refuse to visit again. 1- http://wiki.tcl.tk/4191 http://wiki.tcl.tk/4191 2- http://www.rpi.edu/dept/rcs/packages/ppres/1.10/common/samples/eggs.ppr http://www.rpi.edu/dept/rcs/packages/ppres/1.10/common/sampl...
- ArkyBeagle 11y agoTcl requires a certain level of stylistic discipline and rigor. You are not wrong about tracking down a typo but that's a problem anywhere. That Perspecta file is not pretty to look at.
- deleted 11y ago[deleted]
- icedchai 11y agoExactly. Tcl was intended for embedding into other applications, not for writing fully blown applications itself.
- KasianFranks 11y agoGood to see Tcl here. I use it in depth for AI algos.
- blacksqr 11y agoMore information please!
- KasianFranks 11y agohttp://summarai.com/summarai/ http://summarai.com/summarai/
- blacksqr 11y agoNice! I hope one day you can explain in depth how you use Tcl there.
- xantronix 11y agoWow. So I popped in the first seven paragraphs of the text of Wizard People, Dear Reader: http://www.erikkennedy.com/wizardpeopledearreaders.html http://www.erikkennedy.com/wizardpeopledearreaders.html ...And out popped a bloody good summary I couldn't have written better myself. I second blacksqr's sentiment and would love to see more of the guts of this dashing, dangerous beast of a thing you have unleashed upon this planet.
- esailija 11y ago> Pedantically correct syntax parsing (list, script and expressions), to the extent possible in Javascript. What does that mean? If it's possible to write x86 that runs linux in JavaScript, why is it not possible to write a parser?
- ilostmykeys 11y agoTcl meets Javascript: a match made in heaven. (Interpret as you will)
- xantronix 11y agoTcl's pretty mindbendingly cool. Don't ever let anybody convince you otherwise. It may not do all the things on earth you'd want it to do, but by Lady Circe the things it does offer are solid as a bank vault made of Volvos. Asynchronous programming baked into the core since time immemorial and possibilities of metaprogramming that would make any Lisp blush? Traits to be admired, indeed.
- amelius 11y agoSee also "Tcl the Misunderstood" [1] An interesting discussion here: [2] [1] http://antirez.com/articoli/tclmisunderstood.html http://antirez.com/articoli/tclmisunderstood.html [2] http://lambda-the-ultimate.org/node/3891 http://lambda-the-ultimate.org/node/3891
- denniskane 11y agoI also have a sandboxed interpreter in my site... I use JS to parse strings of shell/bash text. The site is a full-scale desktop environment in a browser: https://linuxontheweb.appspot.com https://linuxontheweb.appspot.com It is Chrome only as it relies on access to a local filesystem, and using Native Client plugins.
- aidanhs 11y agoWriting such a thing from scratch is pretty impressive - the twelve rules of Tcl syntax are readable (http://www.tcl.tk/man/tcl/TclCmd/Tcl.htm http://www.tcl.tk/man/tcl/TclCmd/Tcl.htm), but it's up to you to figure out the edge cases! As a different take on the same problem, I compiled Tcl to JS with Emscripten - http://aidanhs.github.io/emtcl/ http://aidanhs.github.io/emtcl/. I also wrote a toy DOM library (https://github.com/aidanhs/emtcl/blob/master/opt/dom.c https://github.com/aidanhs/emtcl/blob/master/opt/dom.c) which plugs into it which you can see demonstrated on the page. One of the nice things about EmTcl is that you can include arbitrary C extensions by also compiling them with Emscripten, which is how the DOM library above works. As a more comprehensive demonstration, have a look at TclDis (http://aidanhs.github.io/tcldis/ http://aidanhs.github.io/tcldis/). That has Tcl, a Tcl C extension I wrote for Tcl <-> Python communication, a Python interpreter and the Python script I wrote for performing Tcl decompilation all in the same page! (it probably won't work well on a mobile browser) Emscripten truly is incredible.
- fuck_dang 11y agoDo you think TCL has a future in embedded domains the same way that Lua does? It seems to me (not that I know anything) that a lot of folks are stuck on TCL as that thing they had to write to make Tk applications. GNOCL exists now, and there's TCL.js here now that could bring TCL to an even larger audience. I mean, TCL with js-extensions could be a game-changer.
- Frondo 11y agoNo, I don't think it would be. I spent several years writing a lot of Tcl, and there are too many show-stopper problems in the language and community for it to be involved in any kind of game-changer. The language looks good on paper. It's also used widely enough to hold onto "legacy but useful" status for a long, long, long time (think cobol or fortran--there are still people writing new code in these languages, but only in very narrow niches, very little general-interest code). There's a ton of weird gotchas, though, once you start writing in it that will drive you mad. Like the bracing rules that make sense until they don't, and then you have to make a really careful re-read of the so-simple 12 rules: proc a {} { puts "}" } "extra characters after close-brace" ??? The regexes are also weird. Not a week goes by I don't have to wrestle with one of my legacy tcl scripts (getting close to replacing them all, after enough of this weirdness). And don't expect Tk apps to look good anywhere at this point. BUT....you get used to that stuff eventually. The real problem, though, is that there's just no one left to actually address any of the problems in the language. The core team is there, but they're mostly just keeping things chugging along. Very little in the way of new ideas going around. It has a very small and shrinking community, though, which leads to a vicious circle of, almost no one uses it for cool new things, almost no one blogs or writes about it in a promotional way, so there's almost no pull for new people to start writing in Tcl. There's no "killer app" and no one doing the leg work about it to introduce anyone new. The community keeps shrinking by attrition. The online faces of Tcl, the main site and the wiki, have also suffered from probably the worst bikeshedding and, for lack of a better turn of phrase, old fogeyism I've ever seen in any kind of project. Landing on a wiki page and finding 15 year old discussions about long-gone aspects of the language, the place is like a ghost town. Also not going to bring in a lot of new people that way. Aaaaand...why does any of this matter? Because the standard library is small and missing a lot of useful modern stuff for the generalist. It's often not well-documented, and you won't find any example code on a blog anywhere, so you're on your own. You're going to implement a lot of stuff that, if you'd started your project anywhere else, someone else has already done and posted to Github. I think it's admirable how the handful of remaining core maintainers have brought the language kicking and screaming into the 2010s. They're squeezing a little more life out of the ecosystem and I commend them.
- SFjulie1 11y agoTcl/Tk interpreter and C libs are way more portable than js. It is actually stupid. If we revamped the tk default look and coded directly in tcl/tk "apps" would more secure by default, less costly and doing the job a tad more correctly. Instead of using UDP like stream over HTTP (webosckets) we could even use UDP or RTP or whatever native protocol that does the job. Even TCP. We could actually do the application without frameworks, without all these stacks, and with far less interoperability headaches (like testing for all browsers) and less vulnerabilities. Not to say js is insane. What is the competitive advantage for the web stack nowadays compared to tcl/tk after all?
- jnbiche 11y ago> What is the competitive advantage for the web stack nowadays compared to tcl/tk after all? Unlike TCL/TK, web stack already installed on 99% of computers, ready to use with no explicit installation steps other than loading a page. That counts for a lot.
- blacksqr 11y agoRegrettably, that counts for everything. I wonder what the answer would be if "competitive" were changed to "engineering"?
- scotty79 11y ago"Engineering" advantage of webstack over Tcl is that it's actually running various, daily used apps on those 99% (or more) computers so lots of kinks were ironed out.
- SFjulie1 11y agoSo you are a lemming suffering a Stockholm syndrome? Go on. I am no lemming I will watch you with all the other unicorned lemmings experience the explosion of the IT bubble while I can still adapt with 20 yo technologies.
- 11y ago