I think this one falls under the category of "reasonable, but currently 
unimplemented feature." Not sure if there's a JIRA ticket open for this 
(nothing springs to mind). Worth opening one, I don't see any reason not to 
support this.

-----Original Message-----
From: Stephen Haberman [mailto:step...@exigencecorp.com] 
Sent: Monday, August 23, 2010 1:36 PM
To: thrift-user@incubator.apache.org
Subject: const bug

Hi,

We're running an old pre-0.3 thrift and trying upgrade, but running into
a compile error. I've reduce it down to this example:

    struct A {
      1: string name = ""
    } 
    const A DEFAULT_A = {}
    struct B {
      1: A a = DEFAULT_A
    } 

The problem is that with "a = DEFAULT_A", we get this exception:

    type error: const "a" was declared as struct/xception

If I remove "= DEFAULT_A", then it works great.

Just looking at the thrift file, using the DEFAULT_A const as a default
value seems to make sense. Is this a bug, or is it really illegal to use
const structs as default values?

Thanks,
Stephen

Reply via email to