Live data from Hacker News

Wacl: Tcl distro customized for WebAssembly

fossil.e-lehmann.de

11–20 of 68 posts

Re: Wacl: Tcl distro customized for WebAssembly

#11
post #10
post #2

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.

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.

[deleted]

Re: Wacl: Tcl distro customized for WebAssembly

#12
post #10
post #2

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.

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.

> 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 ?

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.

Re: Wacl: Tcl distro customized for WebAssembly

#13
post #5

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 ) Is there something special about Tcl that makes it a joy to use?

There's a situation that springs up sometimes that is perfect for Tcl/Tk: when you need to write a small app with a GUI and you would like it to be multiplatform.

Say you want to write an app to rename files in batch, or a wrapper for Ghostscript that automates certain tasks. With Tcl/Tk you can immediately run it on most Linux distros and with Freewrap you get a Windows executable that's a few MB+your source (it's a lot better than having your users install Java).

Re: Wacl: Tcl distro customized for WebAssembly

#14
post #6
post #4

Earlier quoted context omitted.

I've tried. It's just hard, frankly. I'm just not that good a coder :(

Ehh I don't think so. I'm certain that you are a good coder. You just need to learn more about the techniques needed to implement a Perl to WASM compiler, and obviously, a ton of time. You can do it man.

The stuff which makes perl really awesome are the distributions on CPAN.

Many (though not all) of these distributions contain XS, which is a type of glue between perl and C. Most of these XS distributions are there to link to some library -- Math::GMP, for example, lets perl code use the GNU gmp multi precision math library.

Without some way to make use of distributions with XS parts, then a perl to $other_language_here transpiler is not going to be very interesting.

Re: Wacl: Tcl distro customized for WebAssembly

#15
post #6
post #4

Earlier quoted context omitted.

I've tried. It's just hard, frankly. I'm just not that good a coder :(

Ehh I don't think so. I'm certain that you are a good coder. You just need to learn more about the techniques needed to implement a Perl to WASM compiler, and obviously, a ton of time. You can do it man.

I know you're being encouraging, but I think you're underestimating the complexity of Perl parser. From what I remember, there were three subsystems that voted for each expression what programmer meant.

Re: Wacl: Tcl distro customized for WebAssembly

#16
post #10
post #2

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.

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.

GC is not as far off as you might think. A markdown overview has been merged and there is a PR for impl in the interpreter. See PRs at https://github.com/WebAssembly/gc

Re: Wacl: Tcl distro customized for WebAssembly

#17
post #9
post #5

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 ) Is there something special about Tcl that makes it a joy to use?

A fair amount of the popularity was being the first scripting language with a reasonably complete, cross platform, UI widget toolkit. It was also very easy to embed inside a C application for a user facing scripting capability.

> A fair amount of the popularity was being the first scripting language with a reasonably complete, cross platform, UI widget toolkit.

That wasn't my experience. At least in tcl/tk 8.5 things like zooming in/out of a tk canvas or updating a progress bar were a real pain.

For example, tk canvas has this nice, seemingly simple subcommand called "scale" that looks like it does exactly what it's called with a tag and two double-precision floats. Apply it and all the relevant tk items are scaled accordingly. It even has a predefined tag called "all" that applies to all current tk canvas items. Trivial. Awesome.

Except text items don't get scaled. And font sizes are limited to integer pixel/point sizes. So zooming is actually non-trivial. Not awesome.

There are a sufficient number of such idiosyncracies that if you want to make a clear, usable interface you end up battling the toolkit.

Also, on the tcl language level I felt the "everything is a string" feature gets in the way. I'd much rather have implicit expressions and explicit string declarations.

Re: Wacl: Tcl distro customized for WebAssembly

#18
post #7
post #5

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 ) Is there something special about Tcl that makes it a joy to use?

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 .

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

Re: Wacl: Tcl distro customized for WebAssembly

#19
post #10

Earlier quoted context omitted.

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.

> 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 ? 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.

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

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

Re: Wacl: Tcl distro customized for WebAssembly

#20
post #9

Earlier quoted context omitted.

A fair amount of the popularity was being the first scripting language with a reasonably complete, cross platform, UI widget toolkit. It was also very easy to embed inside a C application for a user facing scripting capability.

> A fair amount of the popularity was being the first scripting language with a reasonably complete, cross platform, UI widget toolkit. That wasn't my experience. At least in tcl/tk 8.5 things like zooming in/out of a tk canvas or updating a progress bar were a real pain. For example, tk canvas has this nice, seemingly simple subcommand called "scale" that looks like it does exactly what it's called with a tag and tw…

All fair, but you have to take the time period in context. There wasn't the plethora of choice we have today.
Post reply on HN