icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

FFI completeness test

Open robertbastian opened this issue 1 year ago • 7 comments

robertbastian avatar Jul 28 '22 23:07 robertbastian

oh, never mind, it did

Manishearth avatar Jul 29 '22 14:07 Manishearth

I'm somewhat disillusioned about this. Ignoring all traits other than Writeable, our API surface is still more than 1000 elements (and this already excludes functions like From::from and ToString::to_string which maybe should have FFI equivalents). I think for a lot of them it doesn't make sense to force FFI equivalents, but it's a case-by-case decision.

I also think the rustdoc JSON output is broken. Spot-checking, it doesn't list any of the methods on ListFormatter (not a bug in the tool, they don't exist in the JSON file). So that diminishes the value of this even more.

robertbastian avatar Jul 29 '22 14:07 robertbastian

This tool solves a real problem. Just this week, we discovered that PyICU was missing a wrapper for a function on TimeZone that had been there for almost 10 years, not fixed until a Googler trying to use the function reported it as missing. In general, I can remember at least a half-dozen times over the last couple of years that I've tried to use some type of wrapper layer and the wrapper layer was missing some function from the core library and I had to find a workaround.

So I think having an imperfect tool is better than having no tool, and we should file bugs to track improving the output quality.

sffc avatar Jul 29 '22 14:07 sffc

Yeah but

  • This doesn't list all functions we do want FFI for (because bug)
  • This lists lots of functions that we do not want FFI for

so this will be all manual anyway.

robertbastian avatar Jul 29 '22 15:07 robertbastian

Actually, the majority of items that I see in the output list are actionable. Adding a few more exclusions on the module and struct level will make the list even more focused. We can then measure FFI completeness in terms of every function being either FFI'd or excluded with an appropriate comment.

sffc avatar Jul 29 '22 15:07 sffc

What exclusions do you have in mind?

robertbastian avatar Aug 02 '22 16:08 robertbastian

Ping

robertbastian avatar Aug 10 '22 12:08 robertbastian