Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make = "" optional in reason syntax #2422

Closed
bobzhang opened this issue Jun 15, 2019 · 3 comments · Fixed by #2464
Closed

Make = "" optional in reason syntax #2422

bobzhang opened this issue Jun 15, 2019 · 3 comments · Fixed by #2464

Comments

@bobzhang
Copy link
Contributor

[@bs.obj]
external bsObjMake: (~comment: string=?, ~platform: string, unit) => _ = "";

it would be nice to just have

[@bs.obj]
external bsObjMake: (~comment: string=?, ~platform: string, unit) => _  ;
@baransu
Copy link

baransu commented Jun 15, 2019

Would it behave the same for all external? With [@bs.obj] it makes sense to omit = „” but with other cases like actual bindings I have strong feelings about not using = „” at all. It’s one of the common bug sources in my team. Someone changes external fn name and runtime errors pops up :/

@bobzhang
Copy link
Contributor Author

bobzhang commented Jun 16, 2019

@baransu I agree with you that not using = "" in most cases except bs.obj. And we are going to warn users when seeing ="". For bs.obj, it has to be an empty string.
There are other attributes which expect to be empty strings, bs.get_idex, bs.set_index

@jordwalke
Copy link
Member

I could also see this being useful if someone made a ppx plugin for automatically creating c bindings or bindings to other languages. Good first task as it's pretty easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants