The Little Programming Language
little-lang.org
little-lang.org
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.
hey, that describes my very first development job! i wrote a cross-platform tcl-based installer for a desktop application at the first company (a small startup) i ever worked for. it was really easy to write (i was literally 17 years old) and there were fairly solid libraries for doing windows-y registry-ish things and unixey install things too. one of the senior guys on the team took my code and integrated it into their cross-compiled build system and it spat out a very decent product that helped our users install the program on i think 3 or 4 different platforms (win95, linux/X, and solaris, possibly HPUX or some other weird platform). that was my very first significant contribution to any software project.
i seem to remember that at the time the shrinkwrapped installer licenses cost $10's of thousands for commercial use. it probably took about 60-80 hours of my time at $17.50 an hour... clearly a bargain.
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.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
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.
is decent place to start. Then move on to
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:
I'm aware of tsv package (shared variable), but this is just sharing scalar variables or arrays. You cannot share objects, procedures, namespaces, resources, etc - and that is the major reason for sharing memory across threads.
1) Application memory consumption grows more than it should, because same extensions have to be loaded several times in the same application, but in separate threads;
2) Resources such as images (or any other kinds), or OO objects, cannot be transferred between threads efficiently, the only way is to serialize them to scalar representation, which then can be passed through either tsv (mentioned above) variables, or through a message to another thread - then deserialize them there. Apart from precious time which it costs, you also make a full copy of resource/object, growing memory consumption even more.
For stuff that has to be fast, I generally reach for 'C', so I have not plumbed the depths of performance with sockets in Tcl.
Again, though, I drank the "everything is event driven" Kool-Aid years ago and it works for me.
Not cherry picked, an "official" page describing lindex: http://wiki.tcl.tk/1481 Objectively compare that with most any other language's docs for lists/arrays/whatever. "Everything is a string" does have some downfalls.
All I meant is that it was clear from the context that an example was chosen showing a weakness of the language (relative to standard C-like syntax) and that it's not quite fair to judge the whole language based on that one example.
Tcl's incredibly simple syntax and lack of syntactic sugar are what lead to situations like that example. But those same things are also responsible for making the language Lisp-like and fairly homoiconic. You can do incredible things in Tcl thanks to its simple syntax which is amenable to macros and code generation.
set j [ lindex $red $i ]
set k [ lindex $green $i ]
set m [ lindex $blue $k ]
set x [ expr $j - $m ]
It's just bizarro lisp without the parentheses.
I just finished skimming through the paper you have linked on the site and liked it quite a bit. It directly answered another question I had, which was what would it take to implement Lisp-style syntax in the same fashion as you did for C-style syntax? I'd normally talk myself out of ideas like that, but your paper is talking me into thinking about it more.
Thanks for sharing all of this!
I'm tickled pink that Little is on the front page of hacker news.
Ok, sounds reasonable. Except... now you have to hire another person to do language development/maintenance :)
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.
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.
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.
The IRC channel seems most active.
“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.[1] http://www.postgresql.org/docs/9.3/static/functions-matching...
[2] http://www.regular-expressions.info/postgresql.html
[3] https://swtch.com/~rsc/regexp/regexp1.html
[4] https://en.wikipedia.org/wiki/Comparison_of_regular_expressi...
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.
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.
Edit: Nevermind - it's in the README.
Anyway, great job! I hope Little's syntactic sugar gets more people exploring Tcl/Tk. Can't wait to give it a whirl.
When people say Tk looks bad point them here: http://www.little-lang.org/gui.html
Tk can look just fine.
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
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).
Wondering how much work that would be...
Thoughtful criticism is fine, but it should be grounded in respect.
So to the extent I think its a joke, I think its intentionally a joke --- and whoever made it I respect their comedic talents.
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.