10 ms·
Tänzer – An industrial web server framework for Tcl
- freyfogle 12y agoDoes the name imply it's influenced by Perl's Dancer framework? http://perldancer.org http://perldancer.org
- networked 12y agoThat's right. The developer has commented about it at http://wiki.tcl.tk/40701 http://wiki.tcl.tk/40701: >xan 2014-10-12: It sure is named after Dancer! However, one of the big draws of tanzer is that it doesn't expect a request handler to read the entire request nor response in one single go, which should hopefully allow for much better performing web applications without standing in one's way much.
- mst 12y agoForwarding for xan due to HN new account comment limits: Yes indeedy! Although as my rather more florid verbiage points out, I do endeavor to make it as anti-framework as possible and more like a library. But then I suppose the only difference between a framework and library, one might posit, is often the presence of an event loop or some damned thing. As part and parcel to a super ultra mega marketing blitz to remind people of the existence of Tcl and indicate to the world that it never really died, it is my solemnly sworn duty to help plant the seeds of a small ecosystem which unifies the divergent elements of the Tcl web framework ecosystem into one that rather more resembles Perl, in that there are so many wonderful middlewares to bridge gaps everywhere. I developed tanzer to try to be the least common denominator of them all, and to somewhat offend (but in a polite way) Node.js' dominance by forcing the agenda of a language that already has a quite nice event loop and asynchronous I/O built in, thank you very much. :D
- darka 12y agoHow prevalent is Tcl usage in the real world? You don't hear much about it, are there any new startups adopting it? Or is it only used in legacy projects at large companies?
- davidw 12y agoIt's definitely not the 'in' thing these days, but it's a very solid, robust bit of code that still makes for a nice language for creating certain kinds of systems.
- lmm 12y agoI know a couple of startuppy companies that are still using it, but it certainly feels like a language in decline. There's a lot that's elegant about it, but the syntax is awkward in practice, and compared to e.g. Python there are fewer libraries available and no really compelling advantage, IMO. It's a language that deserves better than it got - it should've become the standard for *nix config files (thanks RMS for the mess we have now). It should've been the language Sun pushed to run everywhere (it even supported java-style applets in web pages, without the slow vm startup). It should've filled the Lua niche (to a certain extent it did) as an embeddable scripting language. It should've filled the perl niche - it had good support for invoking external executables in a shell-scripting role, and could even be used as a login shell; it had good regex support, and was a first-class programming language that could be used for web backends. Heck, it even did reactive I/O in the very early days (IIRC there was a fantastic server product that was caught up in the demise of Netscape or AOL or some such) - it should've been Node too. But it always felt a bit unloved at Sun, especially post-Java (and to be fair, who can blame them when Java was that popular?), and it somehow never seemed to reach critical mass.
- progman 12y ago> There's a lot that's elegant about it, but the syntax is awkward in practice Don't you like the language (TCL) or the way how GUIs are created? You can also code in C++/Tk for instance. http://cpptk.sourceforge.net/ http://cpptk.sourceforge.net/
- jimktrains2 12y ago> thanks RMS for the mess we have now I'm unfamiliar with the history you're referencing. Was it being anti-executable configs?
- 12y ago
- digital-rubber 12y agoSeeing it works really well, :o) gotta love http 500 errors before you can love the framework i guess, 500 Internal Server Error The server was unable to fulfill your request.
- xantronix 12y agoWell, I certainly wasn't expecting the HN crowd. :)
- ashley_willis 12y agoNobody expects the Hacker News crowd!
- digital-rubber 12y agoi know :) hence the big nose smiley
- vahidR 12y ago500 Internal Server Error The server was unable to fulfill your request. Generated by tanzer/0.1
- xantronix 12y agoTry again! Given that this thing is very much a work-in-progress, and I certainly wasn't ready to submit to HN (don't look at me like that! It wasn't me), I suppose one can forgive a little web framework that could of this sort of thing. I've got lighttpd in front of the site for now until I figure out what broke. :)
- vahidR 12y agoYeah, it works now. I just wanted to notify you though..
- moonstruck 12y ago500 Internal Server Error The server was unable to fulfill your request. Generated by tanzer/0.1
- networked 12y agotanzer.io is taking a while to respond. Here's a CoralCDN mirror: http://tanzer.io.nyud.net/ http://tanzer.io.nyud.net/.
- mst 12y agoGiven tanzer.io was a dogfood deployment, the fact that it held up as long as it did under the HN onslaught is actually pretty impressive.
- xantronix 12y agoI was wondering why I woke up to a 500 Internal Server Error, and why I had ran out of fds. That explains it! Having said that, I'm very keen these days on the idea of implementing usage of libevent into core Tcl 8.6, which would be a fact that tanzer itself would be entirely oblivious to.
- xantronix 12y agoWell! I wasn't expecting THAT to happen. Thanks for helping me find a recent bug, guys! \o/ I'll be cranking out that test suite soon. Site's back online with lighttpd for now.
- xantronix 12y agoGimme a break I just woke up :D But these sorts of little breakages are exactly the thing I want nobody to suffer again as much as possible. And now it seems the world deems it necessary for me to have an HN account! I'll be here all day, try the veal.
- teh_klev 12y agoWell you will go and put something interesting to look at on the web :)
- deleted 12y ago[deleted]
- mst 12y agoRelaying for xan: I'll have you know tänzer is a lady! And a very improper one, at that. In lieu of answering a more technical inquiry, I shall iterate my reasoning for being so persistent in cranking out this piece of software. Quite frankly, it's on account of me becoming quite ROYALLY PISSED with dealing with Impostor Syndrome all these years; it was such to a crippling degree that only today have I bothered even considering getting a Hacker News account. I felt I was a nobody, that I could NEVER possibly belong in the pantheon of bearded programming gods and shiny, happy goddesses, so I lurked. Until this year, wherein I got a proper bonk on the head from a very lovely handful of people in the Perl community who encouraged me to make an ass of myself on stage with a talk on Filesys::POSIX (which I wrote). And I may have pooped out a blag post on Impostor Syndrome along the way, on http://xantronix.net/ http://xantronix.net/. Anyway, pursuant to the idea of utterly crushing and subsequently extinguishing Impostor Syndrome inasmuch as I possibly can with my available wherewithal, I wrote tänzer as a labor of love to myself, and as a tribute to the concept of minimalistic antiframeworks (like antimatter, but antithetical to bulky frameworks instead). So far I think I've succeeded, given that I wasn't quite ready to blast this to the world yet (at least not without some really good profiling and a quite requisite, complete testsuite), people thought it good to release this to the hordes anyway. Such is life. Consider writing software as a love letter to yourself occasionally. It's like taking a bath with candles and some real lovey-dovey music on in the background.
- barbudorojo 12y agoI have just took a quick glimpse and the source seems to be written very clearly. It is an excellent example of how coding in tcl looks like. Perhaps this could be used as an example when you are learning to program in tcl. I don't use tcl neither I know what the actual state of available libraries the performance is, but tcl honors its fame as an easy to read language, this is not Perl. One feature I like a lot is the ability to create secure interpreters that bypass military specifications. Perhaps some benchmarks could give us an idea of what is the current state of affairs in the tcl world, but sometimes the bottle neck code just recurs to calling C libraries. I didn't see that ffi calling here.
- mst 12y agoRelating for xan: One of the things that keeps my heart beating and my pulse flowing is knowing that one day, maybe ONE DAY Tcl can take the limelight again on the stage of web application development and maybe even curl up into a cozy little niche in the ever privacy-abrogating cabal of IoT stuff, too. My choice of language for implementing tänzer is not just due to my love for Tcl's minimalist syntax, but also, as you intimate upon, Tcl's quite lovely FFI. I mean, that's what it was meant to do from the get-go, amirite??? Anyhow. I'd like to rewrite tänzer's guts in C, in a very mongrel2-like fashion, but perhaps less featureful but just as kind to binding by other language FFIs as itself.
- barbudorojo 12y ago"One of the thins that keeps my heart beating and my pulse flowing ...". If you code the way you write anyone could fall in love with your code. Readability and power, passion when coding, that's a very magical and powerful tool. Edited: Grammar.
- deleted 12y ago[deleted]
- rurban 12y agoBeautiful code, beautiful layout. Great, xan
- estrabd 12y agoVery well done, xantronix. Your enthusiasm is infectious.
- yummyfajitas 12y agoWell now I feel old. I remember writing a web app in Tcl way back in 2000 or so right after I graduated. From what I recall, AOLServer was not as fun to program as this appears to be. http://aolserver.github.io/ http://aolserver.github.io/ TCL was actually a pretty OK language. I do remember that aolserver was a major improvement over CGI scripts.
- mst 12y agoRelaying for xan: It still is =) And I hope to spread that love as much as possible by carefully cultivating a tiny, cute little ecosystem of lovely tools on top of tänzer, and help foster the idea of making wonderful web framework middlewares for Tcl to make it a much easier proposition to proliferate our wares to the masses.
- pjmlp 12y agoI joined a Portuguese startup in 1999 that had an in-house Apache module for TCL, an application server similar to AOLServer in design. With an abstraction layer similar in capabilities to what people know Rails for. With lots of C plugins as well. Being part of the core developers meant I was a regular reader on tcl/tk forums, eagerly looking for the upcoming TIPs, following ActiveState work in the community and so on. It was also the last time in my career that I used C on the job, instead of my then favourite C++. I learned lots of stuff while there, but two important things in terms of programming languages were: 1 - scripting languages are great for prototyping 2 - if you ever plan to scale, use a compiled language for the get go instead (JIT/AOT) On our case, due to certain circumstances, we were part of the .NET alpha program and started moving part of architecture to C#/Managed C++.
- davidw 12y ago> 2 - if you ever plan to scale, use a compiled language for the get go instead (JIT/AOT) Like Facebook? I don't think that's good advice, for several reasons: * Everyone dreams about scaling. For most, it's just not a pertinent reality. It's easy to prematurely optimize. * Scripting languages will let you iterate faster, and find some kind of product-market fit. Think about Twitter: I love Rails, but ... no, Rails is not a good fit for what Twitter is. And yet they managed to right the ship and move on to more appropriate systems. If you've got a viable business, you can find the money to improve.
- tnzr 12y agoWell this is awkward.
- mst 12y agoRelaying for xan: Part of my reason for being so hellbent upon proliferating tänzer is to improve the state of affairs for Tcl's perception by the wider community. It's a beautiful language, and a well-considered ecosystem. It never really ceased being that as it aged ever so gracefully, so I figure I shall become some larger-than-life PARTY HARD AND LISTEN TO BEAUTIFUL MUSIC! figurehead to spread some cheer and joy in the community and inspire some newfound personal pride in people's works.
- forkandwait 12y agoTcl is my favorite scripting language for these five reasons: + It combines macro ish text substitution with really, really, really good scoping and loop constructs. + A built in event handler is awesome. + Tk widgets look just fine for the one off GUI that routinizes a single repetitive task. + (Surprisingly) I almost never need float math in a script, one of the things it's not good at. + Tcl doesn't try to provide what should be done in C anyway (Python, Perl, Ruby I'm looking at you....)
- a8da6b0c91d 12y ago> good scoping Wait, you like the upvar stuff?
- forkandwait 12y agoYes, because you rarely need upvar, but when you do, only tcl has it. Also, i know of no other language with macro like substitution along with real local variables.
- xantronix 12y agoIt's astounding the crap [upvar] lets you get away with, ESPECIALLY making your own loop constructs. I'd be boned without it for doing request parsing without the ability to share a string buffer by name, for instance.
- kingmanaz 12y ago>Part of my reason for being so hellbent upon proliferating tänzer is to improve the state of affairs for Tcl's perception by the wider community. It's a beautiful language, and a well-considered ecosystem. After being impressed by the "GopherJS" golang to js transpiler, I would love to see a corresponding Tcl/Tk to js transpiler, particularly one with Tk supported as transparently as possible in a browser canvas (or whatever). Greater than 90% of the GUI utilities I write can be handled using Tk's stock widgets. The ability quickly mash together a Tk interface in Tcl/Tk and compile it to js would be a productivity multiplier. It's almost 2015 and front-ends are still a bear to write and maintain and keeping up with the js framework fads is exhausting. GUI development can and should be as easy as Tk made it ~20 years ago.
- biomimic 12y agoif {[llength $argv] < 1} { puts "Usage: ./joinmods3 <\[file\].joinmods2> \n\n" exit } set HOME [pwd] set DATABASE [lindex $argv 0] set DIM 10000 proc CalcLine {line} { set termData [lindex $line 1] set termDataLength [llength $termData] foreach {x y} $termData { set score1 0 set score2 0 set score3 0 foreach sData [split $y {:}] { set sd [split $sData {,}] set score1 [expr {$score1+[lindex $sd 0]}] set score2 [expr {$score2+[lindex $sd 1]}] set score3 [expr {$score3+[lindex $sd 2]}] } lappend newLine "$x [format %.4f [expr {($score1+$score2)/$score3}]]" } set returnVal "[lindex $line 0] [list [string map {\{ "" \} ""} [lsort -real -index 1 -decreasing $newLine]]]" } proc Invoke {} { global HOME global DATABASE set lCount 10 set wCount 0 set wData "" set f1 [open $DATABASE "r"] set f2 [open ${DATABASE}.j3 "TRUNC CREAT RDWR"] while {[gets $f1 wordByte] >= 0} { incr wCount append wData [CalcLine $wordByte]\n if {$wCount >= $lCount} { puts -nonewline $f2 $wData set lCount [expr {$lCount + 10}] set wData "" } } puts -nonewline $f2 $wData close $f1 close $f2 } Invoke
- xantronix 12y agoPlease explain for the masses!
- biomimic 12y agoAI preprocessing ai priori code. I found that Tcl is the best for this. It includes some efficient structures acute to Tcl. I use Tcl as a rapid application programming and proof of concept language. I find it to be the best at it. Used to use it for chip design too. After that at Berkeley Lab for knowledge discovery and gene discovery.
- general_failure 12y agosite is dead
- xantronix 12y agoReally? Lookin' at it right now. Got a screenshot?
- kingmanaz 12y agoTcl is pragmatic. I still use it for one-off projects with simple GUIs via Tk. I get grief from co-workers for the language, but my projects are typically done and correctly functioning in a fraction of the time it takes our Java and C# devs to even prototype a utility. Below is a walkthrough of Tk which compares identical implementations of examples in Pearl, Ruby, Python, and Tcl. See if you can spot which of the scripting languages are more concise. Hell, I'd even call Tcl more readable in most of the cases: http://www.tkdocs.com/tutorial/ http://www.tkdocs.com/tutorial/ Kudos to the author of Tänzer for doing his part to keep the oft-overlooked Tcl alive.
- xantronix 12y agoHer part =) The problem with humble and beautiful people and things is that, being of such a disposition, one is often not wont to market and self-promote, something I find to be quite endemic of the ever decreasing Tcl community. However, since I've decided to crush my Impostor Syndrome with a pointy heel, I've determined that there's no reason to be shy any longer. Nothing good comes of faulty and detrimental meekness. Therefore I am creating this grandiose and megalomaniac caricature of myself and a web server framework to show the world that, just because a thing isn't well-marketed, that it doesn't deserve to exist, by, well, solving the bootstrapping problem of insufficient marketing. And maybe making some lovely software in the meantime. I think I could go on and on for hours about the technical benefits of Tcl, and even make a non-ironic shit-eating grin through an explanation and ownership of some of its flaws (for instance, lack of garbage collection in TclOO), but I'd like to think this whole hootenanny makes a good object lesson in uniting people and spirits in joyous community and technical excellence. TkDocs.com is a great resource, by the way, and is something I'm taking cues from for writing some more in-depth tutorials and "Getting Started" guides and cookbooks for tänzer. Speaking of which, if you or anyone else you know have any interest and time in helping me with my honey-do list (because "issue tracker" doesn't have that "je ne sais quois" I'm looking for here), that'd be absolutely bloody brilliant. Thanks for your love!
- helmut_hed 12y agoI tried to find you on Twitter, and it corrected my search to "mantronix". No joke. Anyway thanks for sharing your code!
- holtbp 12y agoTänzer is 'dancer' in German, btw. Looks like it was inspired by Perl's Dancer.
- xantronix 12y agotänzer also listens to loads more industrial music than Perl's Dancer, but will often be caught listening to Björk when she's hiding. One thing I'm particularly keen on, with tänzer, is making it possible to easily swap in any ol' static file filtering mechanism by way of ::tanzer::file::handler callbacks. Without even necessarily having to write one's own request handler, one can simply filter the files before serving without any heavy lifting. A few examples would be transparent static asset minification, and template processing. Speaking of which, one of my next priorities is finishing up code and docs for teaspoon (whose file extension is .tsp; HA! HA!) so we can have a demonstrably straightforward set of swappable, pluggable web components in our little Tcl world. http://tanzer.io/git/teaspoon.git http://tanzer.io/git/teaspoon.git
- cestith 12y agoXan's face lights up talking about tänzer like you may expect from her writings here. It's not hard to see why. This is impressive work.
- xantronix 12y agoThanks! You are very sweet. I sincerely hope tänzer sets the right tone for not just the Tcl community, but also so many others that appear to be aging only on account of lacking an influx of new (young) developers. Writing quality code seems to be a pleasant side effect of that. And now, to have a celebratory time over some beer and Dr Pepper and Cajun-flavored wings.