4 ms·
I've been having a wonderful time spinning up small projects using Tcl, Wapp, and Sqlite. Tcl's quoting rules makes it really easy to embed HTML (or anything el
by dmux 5y ago
I've been having a wonderful time spinning up small projects using Tcl, Wapp, and Sqlite. Tcl's quoting rules makes it really easy to embed HTML (or anything else, really) inline within a procedure. Simple example:
# available at /style.css
proc wapp-page-style.css {} {
wapp-mimetype text/css
wapp-cache-control max-age=3600
wapp-trim {
body {
background: aliceblue;
}
}
}
# available at /hello
proc wapp-page-hello {} {
wapp-trim {
<html>
<head>
<link href="%url(style.css)" rel="stylesheet">
</head>
<body>
<h1>Hello HN!</h1>
</body>
</html>
}
}
- linuxlizard 5y agoI loved Tcl way back before I switched to Perl. So cool seeing Tcl and HTML combined like this!
- dmux 5y agoThere are several examples of small applications in the Wapp repository: https://wapp.tcl.tk/home/file?name=examples/ https://wapp.tcl.tk/home/file?name=examples/ I especially like the shoplist one. Such a simple application that's immediately useful.
- scruple 5y agoThis is great! I write a lot of one-off utilities that run on my main desktop as web applications backed by sqlite so you're really speaking my language here! I enjoyed the little bit of exposure that I had to Tcl/Tk through EXPECT, I used to write a lot of embedded test scaffolding using it back in the 00s. I've also been interested in checking out Little Language [0]. Wapp looks like a great place to start with Tcl. [0]: https://www.little-lang.org/ https://www.little-lang.org/