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

Consider shortening the output #95

Open
ekrich opened this issue Jul 2, 2018 · 6 comments
Open

Consider shortening the output #95

ekrich opened this issue Jul 2, 2018 · 6 comments
Labels
bindgen Binding generator

Comments

@ekrich
Copy link
Member

ekrich commented Jul 2, 2018

Currently in hand generated code there are tricks to make the code shorter and cleaner such as use of imports. A good example is the following:
https://github.com/scala-native/scala-native/blob/master/nativelib/src/main/scala/scala/scalanative/posix/dirent.scala

The keys points are the imports that eliminate the native. and Nat. prefixes. Also, in hand generated code the struct is just named dirent.

@jonas
Copy link
Member

jonas commented Jul 3, 2018

Related with #32

The generated code is longer and more explicit by design to avoid having to keep track of whether declarations in the generated code shadows a declaration being imported.

@ekrich
Copy link
Member Author

ekrich commented Jul 3, 2018

It seems that you have already covered this issue. I hoped the native.XXX could be shortened to XXX. Also, there is an issue in Scala Native related. scala-native/scala-native#1197

@kornilova203
Copy link
Member

I think that it is a good idea.
Shorter code may be a default option since names in native and Nat are not common in C, but there also might be an option to generate code with all prefixes.
It will just take some time to make sure that bindgen always generates valid code.

@kornilova203 kornilova203 added the bindgen Binding generator label Jul 3, 2018
@jonas
Copy link
Member

jonas commented Jul 3, 2018

Okay, let's keep it open, but I think we should give it pretty low priority for now since there are a lot of more important things to address.

@ekrich
Copy link
Member Author

ekrich commented Aug 7, 2018

I found another thing that might help. When functions are generated they are given parameter names as anonymous0, anonymous1, ... anonymousn. This could probably be p0, p1, ... pn for params.

@kornilova203
Copy link
Member

I agree, I also do not like anonymous...

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

No branches or pull requests

3 participants