Comments (6)
Yes, that's right. I thought that this is what you were asking, i.e. how to patch ppxlib?
However, looking again at the code, setting default
is not actually the right solution as default
is the value used when the argument is missing.
In the parsetree, ~foo
is represented as ~foo:foo
, and that's how flag
works. So technically you could achieve what you want without modifying ppxlib, by simply matching against foo
.
That said, a patch to add a new function in Args
making this explicit would be welcome. For instance something like this:
type 'a opt =
| Missing
| Present_without_argument
| Present_with_argument of 'a
val opt : ... -> 'a opt param
from ppxlib.
I will try hacky solution using ~foo:foo
first. Don't expect any patch soon
from ppxlib.
@diml Also, I think, that using module Deriving.Arg
we can't specify that generator takes an arbitrary number of arguments of the similar structure. Should I make a separate issue about this?
from ppxlib.
Do you mean you want to write something like this: [@@deriving foo ~x:... ~x:... ~x:...]
, i.e. with the same argument several times?
from ppxlib.
@diml I meant [@@deriving foo ~name1:... ~name2:... ~name3:.... ....... ~name100500:....]
where all name%d
should be arbitrary. As you have probably already guessed I want my generator (foo
here) be extendable by plugins.
from ppxlib.
I see. Yh, please open a separate issue about this
from ppxlib.
Related Issues (20)
- Documentation Doesn't Explain How to Generate a Type Definition that has a PPX Annotation HOT 2
- `esequence` with more than two expressions in `[@@deriving_inline]` HOT 2
- locations check fails for "let open" patterns
- [info request] how is generation of .cmxs done?
- [info request] HOT 3
- Can't get the current path when using ~impl or ~intf HOT 6
- 0.28 release HOT 5
- Docs or examples for `Deriving.Args`? HOT 1
- Follow current OCaml trunk (on a separate branch?) HOT 9
- Outreachy Summer 2023: Improving error reporting in existing `ppxlib`-based PPXs HOT 9
- Improve `Ast_pattern` error reporting. HOT 9
- Metaquot: Embed errors in the AST instead of raising HOT 20
- Ast_pattern: augment API with `ebool`, `pbool` helper, and a new `map`. HOT 21
- `Ast_patter.map0` actually call the continuation when it has only one argument
- `Code_path.main_module_name` is sensitive to line directives
- Having flag attributes is cumbersome with current API HOT 13
- Allow arguments of derivers to have default values HOT 1
- metaquot does not transfer attributes
- Possibly wrong link for merlin HOT 1
- ppxlib#trunk-support on 5.1.0~alpha1 breaks `let f: type a.` syntax HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ppxlib.