167 points · by racketlang · 12y ago · 75 comments
On the other hand, there is evidence here and there that this language isn't commonly used in production. For example, the pattern-matcher is very well-implemented and feature-full, but there's no way to use it programmatically nor is there a way to get the set of bindings. There is also the sad fact that Racket is a Scheme in the traditional Scheme fashion, and so is still trapped in an 80s design aesthetic. Generics are poor, ADTs aren't easily implemented, static types exist but are not so widely used and have strangenesses.
These don't really make sense in the context of Racket. Pattern matching is a macro and thus doesn't exist at run time, though of course with eval the distinction between run time and expansion time is not so well defined. Accessing the lexical environment is not something you do in Racket -- it breaks optimisations and is generally considered a bad idea.
There aren't as many libraries available compared to more popular languages, but I haven't yet had too much trouble getting things accomplished. For the above-mentioned languages we're using, I'd put the useful library situation at: Racket-> Haskell-> Clojure in order of least to greatest.
Depending on what you need it to interoperate with, it's totally usable in production environments as it stands.
While I could probably do everything in one language, I'm not sold on the idea that that's actually a good idea (aside from developer convenience, which considering I'm the only developer I don't rate very highly). I also don't feel qualified enough as a language person to really hold defensible opinions about their relative strengths and weaknesses yet.
For example, part of the system is a network service that runs deployed on servers in our environment. All that code is Haskell. I didn't want to have to deploy and manage an interpreter or JVM on those systems, and I don't trust myself to write C that I feel confident deploying in production. Haskell seemed like a good win there (other folks might use Go, or whatever). It turned out to be really easy to write a network server in Haskell that receives the messages that the service needs to receive. Also, it was the first time I used a language that had good (or really, any) pattern matching, and I'm sold on it.
The "business" logic of the system is all currently in Racket. It could certainly have been written in Haskell, but I'm still getting up to speed in it, whereas I was able to get pretty minimal functionality up and running with Racket very easily.
Right now only the web interface is Clojure. I briefly considered using Yesod for the web piece, but it seemed really complicated. And although Racket has a nice web server, it requires buying into the "continuations" style that they advocate (or rolling your own web libraries, which seemed like a bad idea for this project).
I think the continuation-based approach for web servers is certainly valid, and maybe even technically better, but they're swimming against the tide with that approach, and as web programming is so far my least favorite part of building this system, I wasn't willing to buy into that enterprise.
Thankfully, I was able to get a Clojure web app up and running very quickly (basically just Ring and Compojure).
The system is designed where there's pretty hard boundaries between all the parts, so by the time all is said and done, it might all be written in the same language; but that's not necessarily a design-goal. I figure different languages seem to have different strengths, and there's not really a good reason for me to try and shoehorn everything into one.
Also, that's not a listing of the total number of libraries; it's ranked based on the number of useful ones (where "useful" is a completely subjective term that relates to how often I've looked to see if a library exists that does what I want).
Racket actually has more overall libraries than you'd expect considering its popularity, but I've found that many of them are old, no longer updated, scheme libraries (from the days before Racket rebranded from Dr. Scheme). That certainly doesn't make them useless, but I'm reticent to mix scheme-style code into my project.
I'm least familiar with Clojure (I've only been deploying it for the past two weeks or so), so I'm sure my opinion will change, but right now it feels like a slightly less good Racket with a philosophy I find agreeable and more practical libraries (plus Java interop).
Its built-in image support is much better than anything I've seen in any other language, so I've used it a couple times for writing simulations that need a histogram. It's also much better than Clojure for things that require low memory usage or fast startup time.
http://docs.racket-lang.org/web-server/
I also recently discovered a web sockets library, but am not good enough at coding Racket to use either yet. I am definitely planning on it.
(And seeing you're handle, just want to thank you for your contributions to Clojure; I can only image what would happen if you got more involved in the Racket community).
I mentioned people complaining because, well, people complain when you get timeouts with your continuation. That is why when you click More at the bottom of the page, you see a URL that looks like this:
https://news.ycombinator.com/x?fnid=N5yDJXCzVXXV8kqTp57A7D
I believe this is calling into the continuation space. I could be wrong, however. I am just starting my Scheme journey.
Nonetheless, sometimes continuations do not work well on HN and I see people mention that. It is different way to handle state (Racket calls their Racket server stateless for this reason). I just wanted to point that, even if people will pass judgement from their experience here, it is a cool concept nonetheless.
Also, more experienced people should correct my analysis of HN if I am wrong.
[1] - https://github.com/cocaine/ [2] - http://api.yandex.ru/cocaine/
From what I've read in the past I think most attempts to use Slime with Scheme haven't been wholly successful, hence geiser.
Racket has a good foothold in educational environments, so it's no coincidence that it's conducive to learning. However, Racket also sees a lot of usage in the PL research space, so it's also conducive to just experimenting. Those two combined can make it a very fun environment.
There's also #racket on freenode, which I've found rather welcoming.
On the other hand, if you want to learn Scheme by working through SICP, then I would recommend MIT Scheme to avoid impedance. There's not much benefit from using the Racket ecosystem for that. Likewise, if the goal is to work through On LISP then a common Lisp implementation makes sense.
Of course there's no reason not to have all those languages installed..or at least that's what I tell myself.
My last advice is that Racket is an ecosystem. It provides many languages including Algol and Datalog and Scribble and Typed Racket. This makes for a lot of documentation and it is uneven. The guide will be too shallow and the reference will be more boilerplate rather than providing deeper explanation and further examples.
http://www.neilvandyke.org/racket-sicp/
Also keep in mind there is a different subset language designed by one of the developer/professors for his own book based upon his improvements to the SICP methodology, entitled How to Design Programs, as explained in his paper.
http://www.ccs.neu.edu/racket/pubs/fdpe2002-fffk.pdf
The second edition is available as HTML pages amongst the URLS below.
HtDP is a great book, but no substitute for SICP in terms of content.
However, there hasn't been a release since 2011. The primary maintainer (Chris Hanson) is now at Google, and seems to be busy with other things. Previously, he was at MIT and used to write most of his own research projects in Scheme, so it got a lot more maintenance attention.
Happy Lisping!
If anything, lately Clojure has been drawing on Racket for inspiration in many areas (for example Typed Racket).
In fact, if you wanted to find a criticism of Racket, it might be that occasionally it is "too" modern -- in the sense that some parts are implementations of research papers. You might encounter the occasional module whose documentation isn't much more than "Implements foobars in the sense of Researcher [Year] <link to paywall paper>". To be clear, that is not 98% of Racket. I mention it just to counter the idea that Racket is "less modern". It's constantly evolving with new things.
Finally, for someone getting started with a lisp, Racket is (a) download, (b) install, (c) start coding and running -- within literally 5 minutes. (Of course experienced people aren't limited to DrRacket if they prefer Emacs or Vim or whatever.)
And with ARM this will soon become the only language I need!
http://docs.racket-lang.org/pkg/getting-started.html#%28part...
"prev", "next" (when the table of content is right there next to it) and "top" (usually the header / logo link these days) and collapsible TOC trees screams "we copied this out of MSDN '97 and windows .chm files".
The "...search files..." looks like it was written by a programmer. The white on gray line with the black on white line next to it looks odd. Natural spacing sometimes is a great substitute for lines.
The main docs page (http://docs.racket-lang.org/) contains way too many fonts and way too many colors. Pick a scheme and go with it.
My favourite examples of docs that look like people cared:
http://flask.pocoo.org/docs/quickstart/ (well designed, tasteful font, color and spacing selection)
http://docs.vagrantup.com/v2/getting-started/index.html (lack of search bugs me)
https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child ("hide sidebar" here serves a real purpose: hides the whole thing so the doc display is wider, kinda nice that TOC follows you)
Conclusion: Glad it's improving, but please keep at it! Great docs make your product a joy to use!
-------------------------
edit: let me add some WORSE examples to put things into perspective:
https://www.tcl.tk/man/tcl8.6/TdbcCmd/tdbc.htm
http://junit.sourceforge.net/javadoc/ (ughhhh)
http://www.gnu.org/software/smalltalk/manual/ (whenever I see the gendocs selection page I get nostalgic. Really? 120 vs 420kb? I didn't care even when I was using dialup. Also the "one webpage per node" version almost always sucks because you can't search for anything. And the "all in one page" version sucks because it's too huge sometimes. Who uses the ascii text version or the info docs version?)
The simplest way to make good-looking docs might just be to 'just use Sphinx' (as does Flask, mentioned and http://docs.python.org/ and [many others][1].
Another example of amazing docs (they've always been pretty decent, but amazing in their most recent style) are the PHP docs: http://www.php.net/manual/en/function.pg-affected-rows.php
The docs are a necessity to make up for the shoddy, inconsistent patchwork that is their language design, but they are damned well designed and easy-to-use for the wading through flat scope that is required by those who use the language.
Similarly, styles based on YARD/codo (http://coffeedoc.info/github/coffeedoc/codo/master/) are pretty nice for API references.
[0]: Disappearing sidebar when you resize to narrow, huge amounts of spacing everywhere and sidebar names that can't be expanded without navigating to their root. :/
When Racketeers talk about documentation, they are speaking in Lisp and the context is code as data and data as code. When Racketeers talk about documentation they are talking about Scribble.
http://docs.racket-lang.org/scribble/index.html
Scribble is Racket's documentation tool. It adds an independent documentation phase to the Lisp expansion. Here is Mathew Flatt introducing it:
None of the examples even comes close. The closest thing is EMACS Org.mode, but it is still ad hoc to whatever language one is documenting.
I liked the presentation. The @ notation is kinda neat and elegant, and no doubt enabled by the ridiculous power macros give you in terms of modifying how everything is parsed. It's cool that it's implemented as a DrScheme lang, and it can run and is all code-is-data-y, and it's not a totally separate language. However, I don't really see anything in here that any modern document processor (say http://sphinx-doc.org/) can't perform.
The second-last question brings up a great point that when you tightly couple your documentation language with the platform (PLT), you run the risk of it being a PITA to use it to document other languages. I think the presenter's solution of automatically creating stub classes and such is really unsatisfactory and kinda kills the benefits.
So there you have it, there are pluses and minuses. I think Scribble is neat, but it's really not all that out of the ordinary.. It's definitely not true that "nothing comes close".
* That it's a full programming language, unlike systems like Markdown, or Sphinx, or JavaDoc, or other similar systems. But it also doesn't sacrifice being easy to write, the way that text is easy to write.
* That is works properly with binding. If you're documenting a function, you want to document the correct one -- that's handled with binding, the same way it works when programming. When you're writing an example, the same should be true -- again, handled with binding in Scribble. This works for _programs_, not just identifiers, which is what it looks like Sphinx does. That's why, for example, every single identifier in the examples on http://racket-lang.org is hyperlinked to its documentation. If you go to http://docs.python.org/3/tutorial/controlflow.html , the examples aren't hyperlinked at all.
Specifically, previous/next are great if you are reading it straight through. I agree this isn't that likely, but is nice to have. (I have actually used these. Recently, even.)
The fonts and colors are mostly pleasant. I can see how you would like other schemes. But I can't find anything atrocious.
I love how linked everything is. Specifically in the code samples. Even in the intro[1], all code samples are linked to the docs for what is there. Contrast this with the flask documentation, where if I want to see what @app.route does, I have to go find it elsewhere.
So, yes. There are things I would find to complain about if asked to look for them. At no point in actually perusing and using the site have these ever bothered me. And there are more niceties thrown in there that have made things easier than any of the complaints you mentioned.
Despite me not really liking Java all that much, the javadocs can be very useful; although in that example they chose a bad non-default colour - black on (dark) green is difficult to read.
Here's a better example, they normally look more like this: http://www.jdom.org/docs/apidocs/
The current look of the Racket documentation was designed by Matthew Butterick. You can see his excellent book on typography and design here: http://practicaltypography.com/ -- and it was made with Scribble, the same system that generates Racket's documentation.