
Little: a tcl-based c-like scripting language - cisstrd
http://www.little-lang.org/index.html
======
tclmeelmo
I really, really like that "Why?" explanation page; I feel like many projects
could benefit from copying that idea.

Frequently, the first thought I have when I see projects is, "okay, neat, but
why does this exist?", and the answer takes some digging. It's wonderful that
in this example the answer is made so obvious.

~~~
tyingq
> I really, really like that "Why?" explanation page;

Me too. Especially the comparison of tcl to their language:

    
    
      set x [expr {[lindex $red $i] - [lindex $blue [lindex $green $i]]}]
    
      vs
    
      x = red[i] - blue[green[i]]
    

I had to work in Tcl early in my career...80 hours a week for a straight year,
so I recognized that madness immediately.

~~~
nilkn
Keep in mind that this example was (presumably intentionally) cherry-picked to
show off the worst of Tcl's syntax. It's not really representative of how
expressive the language can be in the right context, and it doesn't show the
benefits that you can get from having a very simple, regularized syntax with
little added sugar.

On the topic of expr, though, it can be avoided if desired in favor of Lisp-
style prefix operators:
[http://www.tcl.tk/man/tcl8.5/TclCmd/mathop.htm](http://www.tcl.tk/man/tcl8.5/TclCmd/mathop.htm)

~~~
luckydude
That example was contrived but it wasn't designed to show off the worst of
Tcl's syntax. There is worse out there.

Little wasn't a slam on Tcl, if you think that then you miss the point. Little
is trying to bring people to Tcl. The Tcl ecosystem has a boatload of good
stuff, people should check it out.

But many people are put off by Tcl's syntax, it's fine for glue, which is what
Ousterhout intended, but it sucks for 300,000 lines of code. If you want to
write big programs then perhaps some type checking could help you. And perhaps
some familiar syntax might help. Little is for people that have to maintain a
pile of code.

~~~
nickpsecurity
Whats the best resource for Tcl ecosystem and getting its main benefits?

~~~
luckydude
[http://www.tcl.tk/about/language.html](http://www.tcl.tk/about/language.html)

is decent place to start. Then move on to

[http://www.tcl.tk/software/](http://www.tcl.tk/software/)

and there are all the Tk (GUI) APIs and libraries.

If you wade through that, or you get stuck, #tcl on freenode is a great
resource.

Edit: #tcl told me to pass on this:

[https://core.tcl.tk/jenglish/gutter/index.html](https://core.tcl.tk/jenglish/gutter/index.html)

------
jrapdx3
Always nice to see Tcl/Tk get attention, it's a language I've often found
quite useful. Seems like I'd heard of "L" before in connection with Tcl/Tk,
but not sure it was the same thing as Little.

Certainly seems it could be a good alternative, a quick look at the syntax
makes me think of it like a kind of typed Javascript. The ability to tap into
the underlying language, e.g., event loop, Tk UI, coroutines, should be an
advantage.

There probably is a way to install Little when TclTk 8.6 (and extensions) are
already installed (there's a warning about trashing the pre-installed
binaries), and not have problems due to moving or replacing existing libraries
that applications depend on finding in established locations.

~~~
luckydude
Little is L, we used to call it L and got beat up because you can't google it.
Supposedly googling little-lang is better.

If you build it with our makefile then it will live next to tcltk 8.6. If you
don't then it will want to dynamically link in some libs and it will get the
wrong ones and barf.

~~~
jrapdx3
I remember being interested in L when I read about it a few years ago, so it's
great that it's open-sourced now. Should be fun to try it out. I'll give the
makefile a whirl.

As for the name, "L" _would_ be hard to Google, though "C" and "Scheme" are
too. While I guess "little" would be somewhat easier to search for than "L",
it sure isn't as obvious as "Clojure" or "fortran". Outstanding names are hard
to invent.

~~~
luckydude
Let us know what you think. This thread will be fleeting, we are on the IRC
channel as well as the forum at [https://users.bitkeeper.org/c/little-
language](https://users.bitkeeper.org/c/little-language)

The IRC channel seems most active.

------
kingmanaz
Banging out GUIs in Tk is a delight when contrasted with developing in
whatever javascript framework is popular this hour. Tcl itself is pragmatic to
an extreme; a great framework for both organizing large projects and heaping
up fast primitives written in C.

Anyway, great job! I hope Little's syntactic sugar gets more people exploring
Tcl/Tk. Can't wait to give it a whirl.

~~~
luckydude
You hit the nail on the head. Tcl/Tk doesn't get enough love, it's a really
useful system even after all these years, it's gotten much better in terms of
looks and it was always great in terms of what it could do. All Little does is
make it more approachable for the 9x% of the world that prefers C, types, etc.

When people say Tk looks bad point them here: [http://www.little-
lang.org/gui.html](http://www.little-lang.org/gui.html)

Tk can look just fine.

~~~
cosarara97
> Firefox vs us on Linux

That's a bit of an unfair comparison. Gtk has lots of nice themes which AFAIK
Tk can't use. That dialog doesn't exist on Firefox anymore, but this is what
Thunderbird's preferences look like on my machine:
[https://my.mixtape.moe/fggaex.png](https://my.mixtape.moe/fggaex.png)

It's true, Tk can look _okay_ on linux, but it will still be out of place when
placed side by side with Gtk and Qt apps (Qt can use Gtk themes).

~~~
luckydude
Yup, that's the price you pay for having it cross platform and avoiding C++.
If I were making that choice today, might lean towards Qt, but I'm not sure.
Tk's widgets are really pleasant to use, the last time I looked at Qt it was a
lot lower level (may have gotten better, it's been a while).

------
nprescott
From the "L Programming Language" PDF:

    
    
        “It’s like perl without the nastiest bits.”
    

I think that really does capture the spirit of what this language looks like.
I'm not sure it will reach any kind of general applicability, but it seems
like a tasteful nod to the extensible nature of Tcl either way. Curious to see
the inclusion of PCRE over Tcl's ARE which I thought was pretty routinely
trotted out as a better performing, more limited, RE engine.

~~~
bch
"higher performance" depends on the specific case. I think the Tcl RE engine
(Henry Spencer's[0], which is also used in PostreSQL[1][2]) does avoid some
pathological cases where Perl/PCRE fall down[3], but PCRE does best Spencer's
work in other areas. They also simply have a different feature list[4].

[0] [http://wiki.tcl.tk/396](http://wiki.tcl.tk/396)

[1] [http://www.postgresql.org/docs/9.3/static/functions-
matching...](http://www.postgresql.org/docs/9.3/static/functions-
matching.html)

[2] [http://www.regular-expressions.info/postgresql.html](http://www.regular-
expressions.info/postgresql.html)

[3]
[https://swtch.com/~rsc/regexp/regexp1.html](https://swtch.com/~rsc/regexp/regexp1.html)

[4]
[https://en.wikipedia.org/wiki/Comparison_of_regular_expressi...](https://en.wikipedia.org/wiki/Comparison_of_regular_expression_engines)

------
luckydude
BTW, a buried discussion here:
[https://news.ycombinator.com/item?id=11527154](https://news.ycombinator.com/item?id=11527154)

------
sea6ear
I haven't tried this yet, I've just looked at the examples in the docs.
However, I think this could be pretty cool.

I think the combination of the Perl influences with the possibility (which I'm
interested in, but haven't proven yet) of using this with Tclkit (a statically
linked version of Tcl that can just be copied over for deployment) might make
this a nice cross platform replacement for the kind of things I might
otherwise want to do in Awk.

Tcl itself is also certainly a good cross platform Awk replacement, but heavy
regex stuff seems like it might be a bit more concise with this syntax than in
Tcl itself.

~~~
luckydude
Tclkit should work, we haven't tried though. The tcl folks on #tcl on freenode
might be able to help.

Tcl doesn't get enough love, the built ins and the libraries provide a pretty
rich environment and then you toss in Tk and all the Tk extensions and you
have something.

And now you have it all with a C like syntax, kinda cool.

------
yumaikas
Looks like a very interesting little language, I enjoyed working with TCL a
fair bit due to things like wish being so interactive. It's also interesting
that they added pointers to TCL, which solves my biggest gripe with TCL.

~~~
luckydude
Tcl had them already, we're just using upvar under the covers. upvar uses the
variable in the stack frame you specify. Which is clever and all but sort of a
pain to use so we just did the &this_is_sort_of_a_pointer thing but it's a
compiler managed upvar under the covers.

~~~
ob
That was actually the original prototype. Little has moved on to have a
pointer object type.

------
c0d0r
Trying to figure out where the code for Little lives - is it in a fork of the
Tcl/Tk repo itself?

~~~
luckydude
Yes it is a fork but the core team is already trying to unfork it. We're
excited about that and will try and help.

------
c0d0r
I didn't see a LICENSE file on github. What is this code licensed under?

Edit: Nevermind - it's in the README.

~~~
wscott
For other people reading here: It is built on Tcl and released under Tcl's
license. BSDish.

------
sdsk8
Well, this is a really well designed and beautiful language, i really enjoyed
it.

------
sigzero
Congrats on the release!

------
Ericson2314
I...I...still feel like this is a joke, even after reading the "why" section.

~~~
dang
Please don't snarkily dismiss other people's work on HN.

Thoughtful criticism is fine, but it should be grounded in respect.

~~~
Ericson2314
The vibe I got from reading the "why" section was "yeah we had some fun making
this, and yeah we think this syntax is a bit better, but isn't it ridiculous
our boss thought this was a good idea!" Like a wink at anybody who think this
isn't needed.

So to the extent I think its a joke, I think its intentionally a joke --- and
whoever made it I respect their comedic talents.

~~~
luckydude
I'm the boss and I wrote the why page, I was poking fun at myself. Perhaps my
sense of humor needs an upgrade.

~~~
nickpsecurity
I totally missed that the boss wrote that page. Maybe I wasn't perceptive
enough but it came off to me like employees taking a crack at their boss. Not
in Dilbert-style disrespect more as everyone turning an eye-rolling issue into
a fun project. It was funny.

I just didn't think it was you, though. Maybe sign it "The Boss" or something
similar at the end to make sure the rest of us get the full joke.

