On Aug 15, 2016 21:59, "Bobby Holley" <bobbyhol...@gmail.com> wrote:
>
> On Mon, Aug 15, 2016 at 11:53 AM, Henri Sivonen <hsivo...@hsivonen.fi>
wrote:
>>
>> On Mon, Aug 15, 2016 at 6:45 PM, Jim Blandy <jbla...@mozilla.com> wrote:
>> > We're using Cheddar to produce C headers for our Rust mp4parse crate;
as far
>> > as I can see, Cheddar doesn't mangle Rust names.
>> >
>> > The Mozilla C++ style applies only to identifiers defined in Mozilla's
C++
>> > code base, not things that we merely use that are defined elsewhere.
When we
>> > use upstream code, we use its definitions in the form they're offered.
I
>> > think Rust code should be treated similarly to "upstream" code in that
>> > sense, and the C++ should use the Rust names unchanged.
>>
>> encoding_rs has three layers of API:
>>  1) Rust
>>  2) FFI/C
>>  3) C++ that wraps the C API so that it can be used in a C++-like way
>> with unique pointers doing the right thing.
>>
>> I think it's been already established that snake_case should be used
>> on layers 1 and 2. So on layer 1, there is Encoding::for_label(label:
>> &[u8]). On layer 2, there's encoding_for_label(const uint8_t* label,
>> size_t label_len). This is clear, and I don't want to reopen the
>> discussion on that.
>
>
> As mentioned we're doing something different for (2) with stylo, but I
guess the issue is that encoding_rs has non-Gecko consumers? That seems
like a reasonable argument for keeping the C FFI snake-cased.

Hopefully, it'll have non-Gecko consumers. Moreover, the only C++ code that
should be calling layer 2 is the implementation for layer 3, so whatever
naming layer 2 has shouldn't be of concern to Gecko C++.

>>
>> For non-Gecko uses,
>>
https://github.com/hsivonen/encoding_rs/blob/master/include/encoding_rs_cpp.h
>> has:
>> Encoding::for_label(gsl::cstring_span<> label)
>>
>> What I'm asking is:
>>
>> When I take encoding_rs_cpp.h and adapt it to XPCOM/MFBT types for use
>> in Gecko, should this be
>> Encoding::for_label(const nsACString& label) // change only types that
>> need changing
>> or
>> Encoding::ForLabel(const nsACString& aLabel) // change naming style, too
>> ?
>
>
> The latter, IMO.

Ok. :-/
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to