thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allen George (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-4529) Rust generation should include #![allow(non_snake_case)] or force conform to Rust style guidelines
Date Sat, 10 Nov 2018 15:52:00 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-4529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16682477#comment-16682477
] 

Allen George commented on THRIFT-4529:
--------------------------------------

Humorously (I guess this is the story of all programming) this turns out to be more complicated
than expected.

There are a few cases:

1. All lowercase. "foo" => "Foo"
2. All uppercase. "FOO" => "Foo"
3. Screaming snake case (most common, I'd assume). "SCREAMING_SNAKE_CASE" => "ScreamingSnakeCase"
4. Snake case. "snake_case" => "SnakeCase"
4. Camel case. "CamelCase" => "CamelCase"

The problem is, we have to figure out which one of the situations we're dealing with, because
the conversions we'll perform will differ for every one, which is supremely annoying. I tried
to avoid having to differentiate between the cases, but, the default implementations of {{t_generator::camelcase}}
and {{t_generator::uppercase}} make this impossible.

> Rust generation should include #![allow(non_snake_case)] or force conform to Rust style
guidelines
> --------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-4529
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4529
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Rust - Compiler
>    Affects Versions: 0.11.0
>            Reporter: Joshua
>            Assignee: Allen George
>            Priority: Minor
>
> Without this, building a project using a thrift file meant for multiple languages may
end up with many compiler warnings similar to the following:
> {code:sh}
> warning: variant `EXAMPLE_NAME` should have a camel case name such as `ExampleName`
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message