Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
One much loved feature of Ruby is the ease with which the object model allows for internal DSLs. However, "metaprogramming" code, in Ruby, can be hard on the eyes which written in large quantities. "Lispy", a gem by Ryan Allen, was a first step toward a generic decoupling of internal DSLs from their implementation. I forked it, took it a ways further, and used it in a significant refactoring of a gem. During this presentation, I'll demonstrate how the LISPish notion that code is data can go a long way toward easing the burden of implementing internal DSLs Help us caption & translate this video! http://amara.org/v/FGbz/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the presentation titled "More DSL, Less Pain," Evan Light discusses the complexities of writing Domain-Specific Languages (DSLs) in Ruby and explores methods to simplify the process. The talk begins with an introduction to the various kinds of DSLs, particularly internal versus external types, and emphasizes the importance of contextual DSLs. Light recounts his experiences using the Cucumber tool for acceptance testing and introduces his own project, CUDA, which serves as an internal DSL focused on Ruby. He highlights the challenges faced when creating DSLs and uses code samples to show the difference in clarity between verbose and concise examples. Light categorizes DSLs into two flavors: internal and external, specifying RSpec and state machines as examples of internal DSLs. The focus then shifts to contextual DSLs, where state is accumulated across objects, exemplified by Sinatra's mapping of HTTP requests to routes. To illustrate building a contextual DSL, Light shares his approach of using a class for context while employing `instance_eval` to manage nesting within the DSL. He discusses the potential complications arising from this method and introduces the "Lispy" gem, which inspired him to think of DSLs as something more akin to a compiler. Light explains the components of a compiler, such as lexical analyzers and abstract syntax trees (ASTs), and suggests that DSL creation could benefit from these principles. He outlines how the `your DSL` gem he developed extends Lispy's capabilities, providing a structure to create and manipulate DSLs through ASTs. The benefits of using ASTs in DSL design include simplifying the interaction and allowing for flexible outputs. Light concludes by advocating for the use of compilers in internal DSLs to reduce complexity and enhance maintainability. The key takeaways from Evan Light's presentation emphasize: - The distinctions between internal and external DSLs. - The benefits of contextual DSLs and state management. - The importance of ASTs in simplifying DSL implementations and avoiding tight coupling. - The value of using a compilation approach to enhance the clarity and usability of DSLs.
Suggest modifications
Cancel