janestreet / janestreet/ppx_optcomp

A way to define variables on command line

Open
#5 7 comments 3 reactions 0 assignees View on GitHub
enhancement forwarded-to-js-devs
Dominant language
OCaml
Stars
66
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Hello,

It would be nice that ppx-optcomp accept some `-D var` option to define a variable on command line, allowing, for example, to use such a flag to compile in {test|debug|...} mode or not. This would allow to use
````ocaml
#ifdef testmode
...
#endif
````
without having to `#define testmode` or not in each file.

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Start at the ppx-optcomp command-line entry point and inspect how #define and #ifdef variables are currently handled. Done means a -D var option defines a variable for conditional compilation, allowing the shown testmode example without editing each source file.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.