SKU/Artículo: AMZ-B0G2KDPD7B

Metaprogramming in OCaml: A Practical Guide to PPX Extensions, AST Transformations, and Code Generation

Format:

Kindle

Hardcover

Kindle

Paperback

Detalles del producto
Disponibilidad:
En stock
Peso con empaque:
0.76 kg
Devolución:
Condición
Nuevo
Producto de:
Amazon
Viaja desde
USA

Sobre este producto
  • Ever find yourself writing the same to_string function for every new record type you create? You add a new field to your type, but you forget to update your printer, and suddenly your debug logs are incomplete. It’s a frustrating and needless source of bugs.What if you could just... not?What if you could "teach" the OCaml compiler how to print your types for you? Imagine just adding one line, [@@deriving print], and having a perfect, up-to-date printer function generated automatically. What if you could invent your own syntax, like [%html...], and have it transformed into safe, type-checked function calls?This isn't magic. This is metaprogramming, and this book will show you exactly how to do it.What's insideThis is a project-based guide, and I will walk you through everything, with no code left out. You will learn:The Foundation: What the Abstract Syntax Tree (AST) is and how to "see" your OCaml code just like the compiler does.The Toolbox: How to use the ppxlib library, including the Ast_mapper to find and change code, and the Ast_builder to generate new code from scratch.Your First PPX: We build a simple [@hello] attribute to learn the complete setup, from dune files to implementation.Project 1: The Deriver: We will build a complete, professional-grade [@@deriving print] PPX from start to finish. You’ll write a tool that can automatically generate "pretty-printers" for both record and variant types.Project 2: The DSL: We will create a [%html ...] extension node. You’ll build your own safe, embedded Domain-Specific Language (DSL) that transforms HTML-like syntax into secure OCaml function calls.The Polish: How to write robust PPX extensions that provide clear, helpful error messages to your users.The Pro Tools: A guide to testing, debugging, and deploying your new PPX to the OPAM repository for everyone to use.Who it's meant forThis book is written for the intermediate OCaml programmer.If you are comfortable with OCaml's syntax, types, and build system, but you want to unlock a new level of power, this book is for you. It's for anyone who wants to build more powerful libraries, create safer APIs, or simply automate the boring parts of programming.Don't just use OCaml. It's time to extend it.Stop writing repetitive code and start building the tools that write it for you. This guide provides the knowledge and the code to do it safely and effectively.Get your copy today and learn to make the OCaml compiler work for you.
AR$25.624
49% OFF
AR$13.141

IMPORT EASILY

By purchasing this product you can deduct VAT with your RUT number

AR$25.624
49% OFF
AR$13.141

Pagá fácil y rápido con Mercado Pago o MODO

Llega en 12 a 18 días hábiles
con envío
Tienes garantía de entrega
Este producto viaja de USA a tus manos en