scala-native-bindgen
scala-native-bindgen copied to clipboard
Consider shortening the output
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.
Related with https://github.com/kornilova-l/scala-native-bindgen/issues/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.
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. https://github.com/scala-native/scala-native/issues/1197
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.
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.
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.
I agree, I also do not like anonymous...