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

Jesper Reenberg edited comment on THRIFT-1028 at 1/27/11 5:41 PM:
------------------------------------------------------------------

I would say that it should follow the .thrift specification as long as it is 
valid haskell.
But then again, I don't know what the other code generators does. 
The optimal solution would be that it should be easy to move from language to 
language when using the same .thrift file says without having to worry about 
different capitalising in the code generated for the different languages. 

But for a starter, it would be great if the generated haskell code compiles out 
of the box as it is a pain to have to manually edit the files just so it 
compiles.

      was (Author: reenberg):
    I would say that it should follow the .thrift specification as long as it 
is valid haskell.
But then again, I don't know what the other code generators does. 
The optimal solution would be that it should be easy to move from language to 
language when using the same .thrift file says without having to worry about 
different capitalising in the code generated for the different languages. 
  
> field names of structs used with wrong casing in the generated haskell code
> ---------------------------------------------------------------------------
>
>                 Key: THRIFT-1028
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1028
>             Project: Thrift
>          Issue Type: Bug
>          Components: Haskell - Compiler
>    Affects Versions: 0.5
>         Environment: ghc 6.12.1, Thrift version 0.5.0, ubuntu 10.10
>            Reporter: Jesper Reenberg
>            Assignee: Christian Lavoie
>            Priority: Minor
>
> Invalid haskell code is generated using the following thrift code:
> --------------------------------------------------------
> struct Test {
>   1:string Foo,
>   3:i32 BarBaz,
>   4:i32 HestTest
> }
> service Test {
>   bool makeTest(1:Test tst, 2:double i)        
> }
> --------------------------------------------------------
> The wrong casing is generated in the record setter parts of the generated 
> data in read_Test_fields and generation of the initial "record" in read_Test.
> The wrong casing is the first letter from the thrift struct specification 
> always being lowercase when used in the above two generated functions.
> The generated data type is 
> data Test = Test 
>             {
>               f_Test_Foo :: Maybe String
>             , f_Test_BarBaz :: Maybe Int32
>             ,  f_Test_HestTest :: Maybe Int32
>             } 
>           deriving (Show,Eq,Ord,Typeable)
> Where it is used with the field names f_Test_foo, f_Test_barBaz and 
> f_Test_hestTest as seen below
> read_Test iprot = do
>   _ <- readStructBegin iprot
>   record <- read_Test_fields iprot 
>             
> (Test{f_Test_foo=Nothing,f_Test_barBaz=Nothing,f_Test_hestTest=Nothing})
>   readStructEnd iprot
>   return record
> I have downloaded and build the 0.5.0 from http://thrift.apache.org/ and i 
> don't know if it affect older versions as well.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to