{"id":13726234,"url":"https://github.com/bloomberg/ppx_string_interpolation","last_synced_at":"2025-05-07T14:41:51.282Z","repository":{"id":54792314,"uuid":"225669735","full_name":"bloomberg/ppx_string_interpolation","owner":"bloomberg","description":"PPX rewriter that enables string interpolation in OCaml","archived":false,"fork":false,"pushed_at":"2023-03-31T18:01:28.000Z","size":59,"stargazers_count":44,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-19T23:31:59.207Z","etag":null,"topics":["ocaml","ppx","ppx-rewriter"],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bloomberg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-03T16:46:06.000Z","updated_at":"2024-11-05T00:25:59.000Z","dependencies_parsed_at":"2024-01-06T02:03:28.297Z","dependency_job_id":"55994413-7403-4eac-96eb-e501bbd8f09e","html_url":"https://github.com/bloomberg/ppx_string_interpolation","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloomberg%2Fppx_string_interpolation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloomberg%2Fppx_string_interpolation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloomberg%2Fppx_string_interpolation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloomberg%2Fppx_string_interpolation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bloomberg","download_url":"https://codeload.github.com/bloomberg/ppx_string_interpolation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252897424,"owners_count":21821434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ocaml","ppx","ppx-rewriter"],"created_at":"2024-08-03T01:02:56.505Z","updated_at":"2025-05-07T14:41:51.241Z","avatar_url":"https://github.com/bloomberg.png","language":"OCaml","funding_links":[],"categories":["OCaml"],"sub_categories":[],"readme":"# PPX rewriter that enables string interpolation.\n\n## Menu\n\n- [Rationale](#rationale)\n- [Quick start](#quick-start)\n- [Building](#building)\n- [Installation](#installation)\n- [Contributions](#contributions)\n- [License](#license)\n- [Code of Conduct](#code-of-conduct)\n- [Security Vulnerability Reporting](#security-vulnerability-reporting)\n\n## Rationale\n\nThis PPX implements string interpolation with embedded expressions,\nthus enabling simple and powerful templates for code generation and\npretty printing. In contrast to `printf`, string interpolation does not\nseparate embedded variables and context, which is important for\nmedium-size strings (several lines).\n\nWe tried our best to be compatible with future Compiler versions,\nso please do not be surprised if the package is not updated for\na couple years — it works. Please feel free to file an ISSUE if\nthe Compiler update breaks this PPX.\n\n## Quick Start\n\nPlugin uses bash-style syntax for string interpolation and\nthe type of variables and expressions is assumed to be string\nby default:\n```ocaml\nlet name = \"world\" in\n    [%string \"Hello $name!\"]\n```\n\nEmbedded expressions should be enclosed in parentheses:\n```ocaml\nlet hello = \"Hello\" and world = \"world\" in\n    [%string \"$(hello ^ \\\" \\\" ^ world)!\"]\n```\n\n### Non-string types\n\nSince this PPX run before type inference and type checking, rewriter should\nhave the information about the types of embedded values via `Printf.printf`\nformat specifiers:\n```ocaml\nlet a = 1 and b = 1.0 in\n    [%string {|We know, that %d$a == %f$b is %b$(a = int_of_float b)!|}]\n```\n\n### Advanced usage\n\nThe extension is essentially syntax sugar for the `Printf.sprintf` function.\nThe format is assumed to be anything between `%` and the next `$`. The expression\nstring is determined by searching for balanced parentheses.\n\nBoth `$` and `%` symbols can be escaped, i.e. double `%` and\ndouble `$` result in single characters:\n\n```ocaml\n[%string \"This is $$ and %%!\"] = \"This is $ and %!\"\n```\n\nIf the expression is commented out, the PPX dumps the comment with format,\nwithout checking for the type of the format:\n\n```ocaml\n[%string \"The first pythagorean triple: %d$(3), 4, %d$(*5?*)\"] =\n    \"The first pythagorean triple: 3, 4, %d$(*5?*)\"\n```\n\n## Building\n\nTo build the project use `dune build`.\n\n## Installation\n\nTo install the package run `dune install`.\n\n## Contributions\n\nWe :heart: contributions.\n\nHave you had a good experience with this project? \nWhy not share some love and contribute code, or just let us know about any issues you had with it?\n\nWe welcome issue reports [here](../../issues); be sure to choose the \nproper issue template for your issue, so that we can be sure you're providing \nthe necessary information.\n\nBefore sending a [Pull Request](../../pulls), please make sure you read our\n[Contribution Guidelines](https://github.com/bloomberg/.github/blob/master/CONTRIBUTING.md).\n\n## License\n\nPlease read the [LICENSE](LICENSE) file.\n\n## Code of Conduct\n\nThis project has adopted a [Code of Conduct](https://github.com/bloomberg/.github/blob/master/CODE_OF_CONDUCT.md).\nIf you have any concerns about the Code, or behavior which you have experienced in the project, please\ncontact us at opensource@bloomberg.net.\n\n## Security Vulnerability Reporting\n\nIf you believe you have identified a security vulnerability in this project, please send email to the project\nteam at opensource@bloomberg.net, detailing the suspected issue and any methods you've found to reproduce it.\n\nPlease do NOT open an issue in the GitHub repository, as we'd prefer to keep vulnerability reports private until\nwe've had an opportunity to review and address them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbloomberg%2Fppx_string_interpolation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbloomberg%2Fppx_string_interpolation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbloomberg%2Fppx_string_interpolation/lists"}