···44spoiler: Quoting for modules.
55---
6677-Okay, so I don't *actually* know LISP, so this is gonna be a tough one. If I misunderstand something, please help me understand it.
88-99-But from what I know, one of the big ideas of LISP is that code is data, and data is code. I mean, that's kind of [generally](https://wiki.c2.com/?DataAndCodeAreTheSameThing) true, but in LISP it's both culturally and syntactically emphasized. For example, let's take this piece of code in LISP:
77+One of the big ideas of LISP is that code is data, and data is code. I mean, that's kind of [generally](https://wiki.c2.com/?DataAndCodeAreTheSameThing) true, but in LISP it's both culturally and syntactically emphasized. For example, let's take this piece of code in LISP:
108119```lisp
1210(+ 2 2)
···42404341We can't "quote" individual code blocks in JavaScript without losing many benefits of the language. However, what if we could "quote"... an entire module?
44424545-In React Server Components (RSC), that's what the `'use client'` directive [does](/why-does-rsc-integrate-with-a-bundler/#serializing-modules):
4343+React Server Components (RSC) is a client-server programming paradigm that uses a similar idea to refer to client code from the server code. The `'use client'` directive lets you [import code designed for the client--but without running it](/why-does-rsc-integrate-with-a-bundler/#serializing-modules):
46444745<Client>
4846···56545755</Client>
58565959-It marks a piece of code to be treated as data (to be sent to the client).
5757+Like quoting, it marks a piece of code to be treated as data. *Unlike* quoting in LISP, the result you get back is opaque--you can't transform or introspect that code.
60586161-This means that whoever imports `onClick` from the backend code won't get an actual `onClick` function--instead, they'll get `'/js/chunk123.js#onClick'` or something like that identifying *how to load* this module. It gives you code-as-data. Eventually this code will make it to the client (as a `<script>`) and be evaluated there. Then, the `onClick` function will actually exist (and maybe even be called). Unlike with LISP quoting, this is [implemented at the compile time](/why-does-rsc-integrate-with-a-bundler/#rsc-bundler-bindings) using a bundler.
5959+This means that whoever imports `onClick` from the backend code won't get an actual `onClick` function--instead, they'll get `'/js/chunk123.js#onClick'` or something like that identifying *how to load* this module. It gives you code-as-data. Unlike with LISP quoting, this is [implemented at the compile time](/why-does-rsc-integrate-with-a-bundler/#rsc-bundler-bindings) using a bundler.
6060+6161+Eventually this code will make it to the client (as a `<script>`) and be evaluated there. Then, the `onClick` function will actually exist (and maybe even be called).
62626363What this gives us is an ability to write a program that composes behaviors that execute at different stages (on the server and the client) in a very modular way. [See here for example.](/impossible-components/#final-code) The parts outside the "quote" deal with server-only resources, while the parts inside the "quote" are stateful and exist on the client--but they are composed. The server stuff can wrap the client stuff, the client stuff can wrap the server stuff, as long as you're doing all composition from the server. And what doing composition on the server enables is a guarantee that all the server stuff runs [within a single request/response roundtrip](/one-roundtrip-per-navigation/). It's also [progressively streamed](/progressive-json/).
64646565That's kind of it, really. Of course, this is a lot less powerful than quoting because the evaluation strategies are being prescribed by React, and there's no kind of metaprogramming like transforming the code itself. So maybe it's still a stretch.
66666767-I know LISP has a rich tradition of solutions that compose code across multiple environments, with some newer approaches like [Electric](https://github.com/hyperfiddle/electric) picking up steam. I don't understand LISP well enough to understand them but I would love to see more explanations targeted at JavaScript developers, both about prior art and new ideas.
6767+I know LISP has a rich tradition of solutions that compose code across multiple environments, with some newer approaches like [Electric](https://github.com/hyperfiddle/electric) picking up steam. I don't understand LISP well enough to dig deep into them but I would love to see more explanations targeted at JavaScript developers, both about prior art and new ideas.
68686969Thank you!
7070