7 ms·
I've been getting into Racket recently after spending some time with Chicken. I like Chicken a lot. It has a great ecosystem. However, it can't compete with the
by eatonphil 10y ago
I've been getting into Racket recently after spending some time with Chicken. I like Chicken a lot. It has a great ecosystem. However, it can't compete with the Racket standard libraries (and/or libraries that get included by default) -- which are better than most languages its age and popularity (OCaml, Haskell, other Schemes, etc.). For instance, the standard library includes a completely asynchronous web server and asynchronous database drivers.
In general, one of the benefits of Scheme versus (say) Python is the regularity and simplicity of the syntax. It also has a better concurrency story.
Racket also makes it incredibly easy to parse new languages and run them in a JITed intepreter (Racket). Though I haven't played around with this yet. See [0] for a really great example.
There are some not great parts though. You'll need to spend time deciphering the use of custom languages (#lang). I wrote a little about this for #lang webserver [1]. But my biggest issue with Racket right now is its completely useless stack traces. I found an "errortrace" module [2], but it has not helped in practice.
Additionally, the Racket standard library lacks a comprehensive time library and a good string templating library (for HTML generation). I am working on an internal web app in Racket, but am limping through the built-in web-server/template module [3]. There is a mustache implementation but I'm not a big fan [4]. I plan to write a more jinja-like library when it's not a distraction from finishing the app.
Footnote: Scheme is very similar to Standard ML in that it is a simple base that many people experiment with to test out patterns in language design (styles of concurrency, garbage collection, compilation techniques, etc.) Racket is no different. Pycket was posted recently and I found it very interesting [5]. It is written in RPython. In particular, the white paper introducing it has a fascinating background on JITing and compilation techniques in Scheme [6].
[0] http://beautifulracket.com/stacker/ http://beautifulracket.com/stacker/
[1] http://notes.eatonphil.com/2016/29/walking-through-basic-racket-web-service.html http://notes.eatonphil.com/2016/29/walking-through-basic-rac...
[2] http://docs.racket-lang.org/errortrace/ http://docs.racket-lang.org/errortrace/
[3] http://docs.racket-lang.org/web-server/templates.html?q=web-server%2Ftemplates http://docs.racket-lang.org/web-server/templates.html?q=web-...
[4] https://github.com/adolfopa/racket-mustache https://github.com/adolfopa/racket-mustache
[5] https://github.com/pycket/pycket https://github.com/pycket/pycket
[6] http://www.ccs.neu.edu/home/samth/pycket-draft.pdf http://www.ccs.neu.edu/home/samth/pycket-draft.pdf
- notjack 10y agoHi, Racket community member here. Thanks for the in-depth comment about your experience, and thanks for writing about your work with the webserver library! A couple follow up questions if you've got the time: 1. Could you elaborate on the stacktrace issues you encountered? 2. The Gregor package [0] is currently a bit of a community standard for date and time functionality. There's a general desire to merge this into the Racket stdlib. Would this package suit your needs? 3. For string templates, a lot of folks use Scribble "at expressions" via the `at-exp` meta-language combined with format specifiers from `racket/format` to write code that looks very similar to python string interpolation and other language-integrated string formatting systems. You can see an example of that on Greg Hendershott's blog [1]. Would this work for your use cases or were you looking for something a bit more involved? [0] http://docs.racket-lang.org/gregor/ http://docs.racket-lang.org/gregor/ [1] http://www.greghendershott.com/2015/08/at-expressions.html http://www.greghendershott.com/2015/08/at-expressions.html
- disconcision 10y agoHey, I'm a racket beginner and I'm wondering where the best places are to ask questions. I'm asking in general, but also specifically I'm trying to do more complex terminal input/output, and I'm having trouble getting the charterm package running.
- eatonphil 10y agoI've always gotten great feedback quickly on the #racket channel on freenode.
- jbclements 10y agoThere are some very helpful folks on Stack Overflow, but the racket-users mailing list is definitely the authoritative resource. Also, Neil Van Dyke (the package's author) is helpful and responsive.
- eatonphil 10y agoHello! I cannot say for sure that I am not imposing the issues on myself but writing in a bad manner. In particular, syntax errors are reported well. The issue is that runtime errors only seem to report the function in which an error occurred and not even a line number. This makes debugging slow and tedious. The web-server template library has similarly poor stack traces in both runtime and syntax errors. And while I better understand the complexity here, I still feel uncomfortable asking a coworker to contribute with the state of template debug messages. Certainly, compared to the Python standard time library, Racket does well. And between SRFI-19 and Gregor, 3rd-party time libraries are not bad. The biggest thing the standard time library and SRFI-19 misses are some default formatting and parsing constants for the most common formats (like ISO8601). This way users don't need to look up the ISO8601 format every time and and the SRFI-19 format keywords. Furthermore, documentation for and examples of SRFI-19 and the standard time library are lacking. This makes it difficult to get started. The at-exp language may have its use-cases. But I really don't enjoy hacking together HTML templates with it right now. Furthermore, HTML templates are especially a cross-team piece of a project. I think the only suitable tool for it is a simple DSL that (e.g.) doesn't require interpolating Racket to loop over data.