6 ms·
Creating Languages in Racket (2011)
- bmitc 6y agoI really wish the Racket team would write a book on Racket’s language making capabilities, or create a MOOC. I attended Racket School 2019, and it was awesome. The material was well put together and walked us through macros to #langs. But the only published material to walk a person through macros and building languages are Fear of Macros and Beautiful Racket. I have many ideas for little DSLs in Racket, but I am too slow and am slogging my way through learning how to create them.
- Decabytes 6y agoI feel exactly the same way. Racket considers this one of it’s killer features so they should be plastering it all across the Internet.
- ywei3410 6y agoHi, What type of material would you like to see? What parts of the API are you finding difficult?
- disconcision 6y agoAgreed that a book would be great, but worth mentioning that the course page for racketschool 2019 itself now provides the current best intro to syntax/parse and DSL making in racket: https://school.racket-lang.org/2019/plan/ https://school.racket-lang.org/2019/plan/
- bmitc 6y agoThat’s a good resource for sure, so thanks for pointing people there. Basically, it would be great to take that year’s Racket School and turn it into an expanded and more streamlined work.
- rscho 6y agoThere's this https://youtu.be/WQGh_NemRy4 https://youtu.be/WQGh_NemRy4 Pretty basic, but it helped me a bit.
- yaleL 6y agoI think using Racket should be avoided because of its problematic community. I've had disgusting experiences interacting with people from Racket community in the past, but so far I thought I was the only one. Unfortunately, it doesn't seem that way. Recently, a computer Scientist Leandro Facchinetti described in his video his ugly experiences with top people in Racket community. The experience was such that he completely gave up his PHD and the use of Racket forever. You can view the video here: https://www.youtube.com/watch?v=_wY7FBtr7_c https://www.youtube.com/watch?v=_wY7FBtr7_c In the video Leandro Facchinetti says: Speaking of people, it's very sad that I had same bad experiences with some people in the Racket community, especially the people up top because they are the kind of people who are smart and they know about it and they will not lose a chance to tell you. I'll give you some examples: I was at the Racket conference having dinner with one of the creators of the language and some other attendees and the creator of the language had some very good points about higher education and how it is kind of a scam in the U.S. but to prove his point he decided some questions to the waiter that were kind of uncomfortable and everyone at the table kind of cringed. Of course, the waiter was gratious about it but still... As another example, I was talking to another one of the creators of the language and he called one of my collaborators a doofus and the educators at my university, which used to be John Hopkins University, a bunch of donkeys. I understand that he had some points to make about how educators work but this is not the way you make them, right? It comes to a point that when I was talking to the students of these people, they're kind of afraid of talking to their advisors and I must admit that spending time with these people is one of the reasons why I decided to drop out of the PHD and leave academia all together, because if that's how it looks like to be successful in these communities I think I prefer to try to be successful somewhere else.
- rscho 6y agoSeriously, do you have an email alert to come shit on racket with the same comment on HN with a new username every time? :-D You must have had a really, really bad experience.
- deleted 6y ago[deleted]
- 6y ago
- Buttons840 6y agoWhat do you think of https://beautifulracket.com/ https://beautifulracket.com/ ? Isn't it exactly what you're asking for? You seem to say, I wish there was a book on X, but there is only this book on X. What more do you want? I don't mean that rhetorically, what additional things would you like to see covered?
- Decabytes 6y agoI've worked through Beautiful Racket before, though it's been awhile. I think my main issues are 1. You need to install the Beautiful Racket package, which makes the starting point for creating the languages easier, but is not representative of how it's used in the Racket Docs (not that I'm saying the Racket docs have a better intro) 2. Uses Brain Fuck. It feels like there has to be a language that fits in between unintelligible but easy to parse, and extremely verbose and complex. (It's probably scheme but that's taken in this context) And sometimes I just need to see the same problem from a few different angles before it will stick. That's why Greg's Fear of Macros wasn't able to take me all the way to a comfortable place with macros. I think BR is a great book, and I definitely learned a lot from it, I'll probably go back to it at some point to see if I can get it to click. I've been on a Racket kick recently so I've got a decent amount of hours into the language. Also I'm always struck with a feeling when I'm coding in Racket where I go "Would a dsl be good here?" I know Racket makes it easy but I don't even know about what makes a good dsl, or how certain dsls might be harder than other based on the way Racket does L.O.P. Again this might just be from inexperience. Lastly I would also like to see some examples of typed languages being created using typed Racket. I know there is the Turnstile library, but from my understanding it makes it easier to created typed languages, but that the possibility was there before. I'd rather learn the hard unabstracted way first before moving to using a library.
- nextos 6y agoBeautiful Racket is a really nice book. I wish there was a long tutorial on DSLs + static analysis, preferably abstract interpretation. Develop a DSL that is a bit beyond a toy example, and show how to carry out static analysis. All in one place. I think this would help a lot towards making the goal of Racket, language-oriented design, more popular.
- iainctduncan 6y agoIt is certainly true that Racket has a ridiculously low number of books on it that aren't textbooks. It's a real pity. I like Racket a lot, but there is so little focus on use outside of academia that I don't hold my breath on it becoming a production appropriate tool for typical business software.
- spdegabrielle 6y agoIt’s growing; Racket Programming the Fun Way An introduction to the Racket functional programming language and DrRacket development environment to explore topics in mathematics (mostly recreational) and computer science. https://nostarch.com/racket-programming-fun-way https://nostarch.com/racket-programming-fun-way
- spdegabrielle 6y agoMore books at https://racket-lang.org/books.html https://racket-lang.org/books.html
- ssivark 6y agoIf you feel like sharing the ideas, I’m sure many people would be interested in seeing potential example applications where this (abstract and somewhat uncommon, in other languages) capability can be put to good use.
- srcreigh 6y agoYou can go as complex as your own type system. One type system was added to Racket called Typed Racket. No new features were needed in the language or tooling, they just used Racket macros to build a Racket with static compiler errors which integrates with the IDE. Two similar cases. One is Typescript. That's a new language with different syntax, a new compiler which targets JS. It also provides its own tooling for IDEs. Another is Python. Over time there were PEPs to add syntax for type hints, and now type systems are being added to the language. When Racket did this, they were able to do it in Racket without adding more features to the compiler or IDE. There's built in support for static analysis, compiler errors, editor integration. Not to mention a way to organize all the information you need to do type checking in the compile steps, and make that information accessible in the right places. The new type safe Racket was built using plain ol Racket. There's a reasonably accessible paper about this here: https://www2.ccs.neu.edu/racket/pubs/scheme2007-ctf.pdf https://www2.ccs.neu.edu/racket/pubs/scheme2007-ctf.pdf So here are some of my ideas: 1. Play around with static analysis checks. I want to rebuild Typescript style structural inference to Racket. I like how TS is unsound (has no runtime performance penalty for mixing untyped code), and is easily disabled via any if it's in the way. I love the focus on great error messages. Maybe one day I will contribute to Typed Racket :) Making your own compiler error appear in Racket is just 5 lines of code. https://gist.github.com/srcreigh/a0a087adc26e15af0160e8866d48cd1c https://gist.github.com/srcreigh/a0a087adc26e15af0160e8866d4... 2. New syntax for creating structs. Racket had structs that are initialized like (point 1 2). What if you want keyword syntax ie (point #:x 1 #:y 2)? What if you want that to work with match too? Do you want a JS-style syntax such as (point #:x #:y 2) which pulls in x as an identifier? You can do all this! The rebellion library is pretty awesome in this regard [1], with some sample usage of it in a script here [2]. [1]: https://docs.racket-lang.org/rebellion/Data_Types.html https://docs.racket-lang.org/rebellion/Data_Types.html [2]: https://github.com/srcreigh/shift-remapper/blob/main/generate.rkt https://github.com/srcreigh/shift-remapper/blob/main/generat...
- brooksbp 6y agoWhat about "Semantics Engineering with PLT Redex"?
- phonebucket 6y agoPeople interested in language design and learning Racket in one book might enjoy this book https://beautifulracket.com/ https://beautifulracket.com/ Edit: Also Programming Languages: Application and Interpretation, which I haven't been through yet, so can't endorse fully: https://cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/ https://cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-0...
- joubert 6y agoMore books: https://racket-lang.org/books.html https://racket-lang.org/books.html
- submeta 6y agoIs it common to use the Racket IDE or is Emacs equally suitable? So anyone using Emacs to program in Racket Scheme?
- ywei3410 6y agoEmacs is fine; Racket mode is very good [1]; but DrRacket is worth a spin if you're unfamiliar with the language/ideas. [1] https://www.racket-mode.com/ https://www.racket-mode.com/
- JasonFruit 6y agoRacket's IDE is pretty good, but it doesn't match the pure editing facilities of Emacs, and racket-mode supplies similar functionality. I use exclusively Emacs for Racket, and other Scheme-like languages.
- cnasc 6y agoI find Emacs with racket-mode much better for editing, but DrRacket has some really nifty IDE features that racket-mode doesn’t have. I probably split 80/20 between them
- swatson741 6y agoDrRacket is a pretty good IDE but, it doesn't have the flexibility and consistency of Emacs. A lot learning material for Racket features the DrRacket IDE.
- Decabytes 6y agoI find it easier to trace errors in DrRacket than racket-mode, but use Emacs for 95% of my Racket coding
- spdegabrielle 6y agoAs the other commenters have mentioned, Racket Mode is excellent, especially racket-xp-mode: “An optional minor mode that enhances racket-mode to explain and explore code.” https://www.racket-mode.com/#racket_002dxp_002dmode https://www.racket-mode.com/#racket_002dxp_002dmode The other thing worth mentioning is Racketeers often use their favourite editor, only switching to DrRacket or Racket Mode when they need specific functionality.
- tenaciousDaniel 6y agoI'm currently trying to create a language but have never done it before. I'm a web developer, so I'm writing some reduced test cases in Node, but I seriously doubt that I'd use it for actual parsing. Racket seems like a good choice; have never heard of it before. Anyone know the pros/cons/alternatives?
- soegaard 6y agoCheck 1.3 and 1.4 at https://school.racket-lang.org/2019/plan/mon-mor-lecture.html https://school.racket-lang.org/2019/plan/mon-mor-lecture.htm... to get an idea.
- skohan 6y agoI'm working on a language also, it's a lot of fun! What's yours about?
- tenaciousDaniel 6y agoI'm trying to build a language for UI designers. The goal is to give them a very easy language that allows them to describe visual behavior using grammar and concepts that are familiar to them. Entirely declarative, low-tech, almost like pseudo-code.
- gglitch 6y agoI hope to hear more about your project. And fwiw, my very limited experience suggests that Racket may be a great way to start.
- phonebucket 6y agoAre there any vim users that use Racket? If so, I'd be grateful if you could let me know your workflow. Everything seems to be emacs/DrRacket focussed from what I see.
- bchar 6y agoI've used this, for neovim, and it's very good! https://conjure.fun/ https://conjure.fun/ Works with Clojure, Racket, Fennel and Janet.
- phonebucket 6y agoThis is new to me and it looks awesome! Thanks for bringing it to my attention.
- spdegabrielle 6y agoThere are quite a few vim users, to the extent that the manual addresses their needs directly: https://docs.racket-lang.org/guide/Vim.html https://docs.racket-lang.org/guide/Vim.html A common pattern for Vim users is to happily code in Vim and occasionally switch DrRacket for specific tasks. And use the command line tools - https://docs.racket-lang.org/raco/index.html https://docs.racket-lang.org/raco/index.html
- velcrovan 6y agoAfter attending Racket School in 2019, I was able to do a Racket implementation of Tabloid in a couple of days: https://github.com/otherjoel/tabloid https://github.com/otherjoel/tabloid ...fun stuff!
- Decabytes 6y agoOne potentially untapped potential of Racket that I think about is sort of as a universal language platform. Seeing more already existing languages reimplemented in Racket would be cool. I know the underlying implementations of other languages don't always line up to Racket, and that you wouldn't be able to use the libraries of the language in question, but it could potentially reduce the friction of extending software you love. You want to extend this piece of software to suit your needs, but aren't a fan of Racket, extend it in a language with Javascript like, Python like, Java like syntax etc (that ultimately compiles to Racket). An example would be a Game Engine in Racket, that has bindings to other languages a la the Godot Engine, or some other piece of standalone software.
- ralphc 6y agoWould this, or something else, be a good solution for producing XML-based output, similar to an HTML templating language?
- samth 6y agoYes, I think the `xml` library in Racket is quite nice for generating XML and XML-like content: https://docs.racket-lang.org/xml/ https://docs.racket-lang.org/xml/