-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
bindgenBinding generatorBinding generator
Description
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
.
Metadata
Metadata
Assignees
Labels
bindgenBinding generatorBinding generator
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
jonas commentedon 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 commentedon Jul 3, 2018
It seems that you have already covered this issue. I hoped the
native.XXX
could be shortened toXXX
. Also, there is an issue in Scala Native related. scala-native/scala-native#1197kornilova203 commentedon Jul 3, 2018
I think that it is a good idea.
Shorter code may be a default option since names in
native
andNat
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.
jonas commentedon 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 commentedon 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 bep0, p1, ... pn
for params.kornilova203 commentedon Aug 8, 2018
I agree, I also do not like
anonymous...