
Wacl: Tcl distro customized for WebAssembly - blacksqr
https://fossil.e-lehmann.de/wacl/index
======
kristopolous
Of interesting historical note, the W3C HTML 4 standard alludes to TCL as a
possible scripting language when describing the script tag, albeit just as an
example:

[https://www.w3.org/TR/html4/interact/scripts.html](https://www.w3.org/TR/html4/interact/scripts.html)

~~~
pwg
At one point, very early in the web's infancy, before Javascript became "the
one" web language, Sun was considering Tcl for the role that Javascript took
over in the <script> tag.

------
jitl
Why do people like Tcl? I've never tried diving in to using the language, but
I have debugged MacPorts now and then, which is all Tcl, and I've seen that
Tcl UI library used in other scripting languages.

What's the draw, other than having some existing code written in the language?
Gems like the `upvar` command?
([http://wiki.tcl.tk/1508](http://wiki.tcl.tk/1508))

Is there something special about Tcl that makes it a joy to use?

~~~
lmm
It's an elegant, lightweight language, with a design thoroughly optimized for
interactive use. [http://yosefk.com/blog/i-cant-believe-im-praising-
tcl.html](http://yosefk.com/blog/i-cant-believe-im-praising-tcl.html) .

~~~
jitl
Thanks, this blog post was exactly the sort of discussion I was looking for!

The TL;DR:

\- easy to write interactively because there's no fiddling with the parens,
quoting, or commas you find in JS, Ruby, or Python

\- uses [ and ] for subexpressions instead of ( and ), which makes typing
easier

\- "command" oriented, instead of "expression" oriented

\- saner than shell while having many of the same advantages

~~~
denisw
> \- uses [ and ] for subexpressions instead of ( and ), which makes typing
> easier

I would like to point out that in several non-US keyboard layouts, [ and ] are
_harder_ to type, not easier. For instance, on German keyboards, they are
mapped to Right-Alt (AltGr) + 8/9, which is quite annoying to type compared to
normal parentheses (which are mapped to Shift+8/9, with Shift being better
placed and available on both the left and right side of the keyboard).

~~~
yoodenvranx
As a German I haven't use a German keyboard layout in years because the US
layout easier in most cases (for examole all those curly braces in TeX).

~~~
qznc
All my colleagues would agree and did the same. I don't. I want äöü quickly
available for chatting and other "quick" writing, while coding typing is
usually not the bottleneck.

~~~
hawski
Is there a German keyboard layout such as?:

AltGr + a -> ä

AltGr + o -> ö

AltGr + u -> ü

I'm Polish and I'm very glad that our most common layout is like that for
ąćęłńóśźż (with AltGr + x for ź). Currently I'm in Germany and I wonder if
there is similar layout for German umlauts.

~~~
yoodenvranx
There seems to be a layout called "US international" which might help:
[https://en.m.wikipedia.org/wiki/File:KB_US-
International.svg](https://en.m.wikipedia.org/wiki/File:KB_US-
International.svg)

------
grondilu
I'm a Perl fan and as such it saddens me to see other languages targeting
wasm. I've been convinced for a while that webassembly is the next big thing
in computing and so far the Perl community as far as I know has shown close to
no interest whatsoever.

~~~
tyingq
Wasm has no facility for GC, polymorphic inline cache, or direct DOM
integration. They are on the roadmap, but probably far off.

So there isn't a direct path to WASM for many dynamically typed languages. Tcl
can get by without all that because it's small enough to just port the whole C
interpreter instead of trying to have tcl compile down to wasm. That would be
very large, slow, and tricky for Perl, Python, etc.

~~~
vvanders
> Wasm has no facility for GC

It shouldn't, GC is a level above Wasm and would complicate languages that
don't use it.

> or direct DOM integration

You mean like this: [https://github.com/tcr/rust-
webplatform](https://github.com/tcr/rust-webplatform) ?

The problem with most dynamic langauges you listed is they do things that the
web doesn't allow or do them in ways that aren't friendly to a browser.

~~~
tyingq
On GC, maybe you should let them know. They seem to be headed down that path:
[https://github.com/WebAssembly/design/blob/master/GC.md](https://github.com/WebAssembly/design/blob/master/GC.md)

Oh, and on direct DOM access. You presented a link to an implementation of
indirect DOM access. They have an open issue you might find interesting:
[https://github.com/tcr/rust-
webplatform/issues/20](https://github.com/tcr/rust-webplatform/issues/20)

------
mappu
I'd be interested to see a Tk implementation.

It would be neat if there were credible alternatives to the DOM.

------
interfixus
At long, overdue, too late last...

In the very early days of the web, I used to fantasize - naively - about the
whole undignified html hodgepodge never having happened, and the entire web
just running on served-up tcl/tk.

~~~
zwischenzug
If you've ever placed a sports bet anywhere in the world online, chances are
your bet went through Tcl code front and back. I spent 15 years writing it.

~~~
interfixus
I didn't ever. But nice to know.

------
zackangelo
I learned Tcl back in the day just so I could customize Eggdrop [1].

[1] [https://www.eggheads.org/](https://www.eggheads.org/)

------
themihai
>> tDOM for parsing and creating XML and HTML content

How is tDOM supposed to work if WebAssembly doesn't have access to the DOM?

~~~
pwg
tDOM is an XML parser based on expat that provides both a SAX and a DOM
parser. It parses into its own DOM that one can then run XPATH expressions
against or manipulate as one sees fit with tDOM's interface methods.

Unfortunately the DOM for tDOM is not the web browser DOM that Javascript
interfaces with. Same term, so very confusing, but not the same DOM's.

------
ecky-l
To clarify: this is the Tcl interpreter compiled to webassembly. Not a Tcl
program or the language.

------
jblow
Guys. Stay away. Tcl is awful if you want to write software that doesn't waste
hours and hours and hours of your precious time hunting down simple bugs that
would not have been an issue in most other languages.

\- guy who used Tcl in like 1992 and helped write a 'compiler' for it, etc.

