[
https://issues.apache.org/jira/browse/THRIFT-6061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer updated THRIFT-6061:
-------------------------------
Description:
Today the D code generation is not possible with recursive structures.
For example test/Recursive.thrift it would produce code like
{code}
struct CoRec {
CoRec2 other;
}
struct CoRec2 {
CoRec other;
}
void main()
{
}
{code}
Which gives
{code}
onlineapp.d(6): Error: struct `onlineapp.CoRec` no size because of forward
reference
CoRec other;
^
{code}
Reason is that D uses structs which (in most/all languages) are embedded and
thus do not allow such constructs. Unfortunately, the D compiler does not offer
any option to switch to classes instead, nor to circumvent the issue in other
ways.
I classsify this as an Impovement. However, since the net impact as of today is
that you cannot use such structures with D, one might also call it a Bug.
was:
Today the D code generation is not possible with recursive structures.
For example test/Recursive.thrift it would produce code like
{code}
struct CoRec {
CoRec2 other;
}
struct CoRec2 {
CoRec other;
}
void main()
{
}
{code}
Which gives
{code}
onlineapp.d(6): Error: struct `onlineapp.CoRec` no size because of forward
reference
CoRec other;
^
{code}
Reason is that D uses structs which (in most/all languages) are embedded and
thus do not allow such constructs. Unfortunately, the D compiler does not offer
any option to switch to classes instead, nor to circumvent the issue in other
ways.
I classsify this as an Impovement. Hoever, since the net impact as of today is
that you cannot such structures with D, one might also call it a Bug.
> Capability for recursive structs missing
> ----------------------------------------
>
> Key: THRIFT-6061
> URL: https://issues.apache.org/jira/browse/THRIFT-6061
> Project: Thrift
> Issue Type: Improvement
> Components: D - Compiler
> Reporter: Jens Geyer
> Priority: Major
>
> Today the D code generation is not possible with recursive structures.
> For example test/Recursive.thrift it would produce code like
> {code}
> struct CoRec {
> CoRec2 other;
> }
> struct CoRec2 {
> CoRec other;
> }
> void main()
> {
> }
> {code}
> Which gives
> {code}
> onlineapp.d(6): Error: struct `onlineapp.CoRec` no size because of forward
> reference
> CoRec other;
> ^
> {code}
> Reason is that D uses structs which (in most/all languages) are embedded and
> thus do not allow such constructs. Unfortunately, the D compiler does not
> offer any option to switch to classes instead, nor to circumvent the issue in
> other ways.
> I classsify this as an Impovement. However, since the net impact as of today
> is that you cannot use such structures with D, one might also call it a Bug.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)