You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by Thomas Dressel <th...@uni-weimar.de> on 2013/06/24 15:40:15 UTC

Forward Declaration

Hello,

I've searched the web and the Documentation of Avro, but I didn't get  
an answer.
So I write this email to you, with the question, if Avro does support  
forward declaration?

I look forward to hearing from you soon.


Yours faithfully,

Thomas Dressel


Re: Forward Declaration

Posted by Scott Carey <sc...@apache.org>.
I apologize, my spell correct renamed "fivebytes" to "five bytes"
everywhere below, spaces aren't permitted in Avro names.

On 6/28/13 9:08 AM, "Scott Carey" <sc...@apache.org> wrote:

>I assume he means the difference between:
>
>{"type":"record", "name":"ForwardRef", "fields":[
>  {"name":"thing_ref", "type": "five bytes"},
>  {"name":"thing_declared", "type": {"type":"fixed", "size":5,
>"name":"five bytes"}}
>]}
>
>{"type":"record", "name":"BackRef", "fields":[
>  {"name":"thing_declared", "type": {"type":"fixed", "size":5,
>"name":"five bytes"}}
>  {"name":"thing_ref", "type": "five bytes"},
>]}
>
>The Avro spec does not currently support the first of the above,
>references must be declared before being used.
>
>
>We could change this, but every language implementation would need to be
>updated, and it could create some compatibility issues (old code would not
>necessarily parse new schemas).
>New features for avro schemas since the start have almost entirely been
>forwards-compatible.  The rare exceptions have been when bug fixes or
>language differences necessitated otherwise.
>
>At the moment, most of the schema parsers eagerly decode named references
>rather than being lazy.
>
>On 6/24/13 10:19 AM, "Thiruvalluvan MG" <th...@yahoo.com> wrote:
>
>>Hi Thomas Dressel,
>>
>>Is it possible to elaborate on what you mean by "forward declaration"?
>>I'm aware of one usage of the term in C and C++ where instead of exposing
>>the full definition of a function, data or class you expose just its
>>declaration and then supply the full definition later. Here is an example
>>with class declaration:
>>
>>class X;
>>
>>class Y {
>>public:
>>    X* x;
>>};
>>
>>class X {
>>public:
>>    Y *y;
>>};
>>
>>This is the only way to handle circular references between classes X and
>>Y. But I don't understand its reference to Avro.
>>
>>Still better, can you give a small example of what you are trying to do?
>>
>>Thank you,
>>
>>Thiru
>>
>>________________________________
>> From: Thomas Dressel <th...@uni-weimar.de>
>>To: dev@avro.apache.org
>>Sent: Monday, 24 June 2013 7:10 PM
>>Subject: Forward Declaration
>> 
>>
>>Hello,
>>
>>I've searched the web and the Documentation of Avro, but I didn't get
>>an answer.
>>So I write this email to you, with the question, if Avro does support
>>forward declaration?
>>
>>I look forward to hearing from you soon.
>>
>>
>>Yours faithfully,
>>
>>Thomas Dressel
>
>



Re: Forward Declaration

Posted by Scott Carey <sc...@apache.org>.
I assume he means the difference between:

{"type":"record", "name":"ForwardRef", "fields":[
  {"name":"thing_ref", "type": "five bytes"},
  {"name":"thing_declared", "type": {"type":"fixed", "size":5,
"name":"five bytes"}}
]}

{"type":"record", "name":"BackRef", "fields":[
  {"name":"thing_declared", "type": {"type":"fixed", "size":5,
"name":"five bytes"}}
  {"name":"thing_ref", "type": "five bytes"},
]}

The Avro spec does not currently support the first of the above,
references must be declared before being used.


We could change this, but every language implementation would need to be
updated, and it could create some compatibility issues (old code would not
necessarily parse new schemas).
New features for avro schemas since the start have almost entirely been
forwards-compatible.  The rare exceptions have been when bug fixes or
language differences necessitated otherwise.

At the moment, most of the schema parsers eagerly decode named references
rather than being lazy.

On 6/24/13 10:19 AM, "Thiruvalluvan MG" <th...@yahoo.com> wrote:

>Hi Thomas Dressel,
>
>Is it possible to elaborate on what you mean by "forward declaration"?
>I'm aware of one usage of the term in C and C++ where instead of exposing
>the full definition of a function, data or class you expose just its
>declaration and then supply the full definition later. Here is an example
>with class declaration:
>
>class X;
>
>class Y {
>public:
>    X* x;
>};
>
>class X {
>public:
>    Y *y;
>};
>
>This is the only way to handle circular references between classes X and
>Y. But I don't understand its reference to Avro.
>
>Still better, can you give a small example of what you are trying to do?
>
>Thank you,
>
>Thiru
>
>________________________________
> From: Thomas Dressel <th...@uni-weimar.de>
>To: dev@avro.apache.org
>Sent: Monday, 24 June 2013 7:10 PM
>Subject: Forward Declaration
> 
>
>Hello,
>
>I've searched the web and the Documentation of Avro, but I didn't get
>an answer.
>So I write this email to you, with the question, if Avro does support
>forward declaration?
>
>I look forward to hearing from you soon.
>
>
>Yours faithfully,
>
>Thomas Dressel



Re: Forward Declaration

Posted by Thiruvalluvan MG <th...@yahoo.com>.
Hi Thomas Dressel,

Is it possible to elaborate on what you mean by "forward declaration"? I'm aware of one usage of the term in C and C++ where instead of exposing the full definition of a function, data or class you expose just its declaration and then supply the full definition later. Here is an example with class declaration:

class X;

class Y {
public:
    X* x;
};

class X {
public:
    Y *y;
};

This is the only way to handle circular references between classes X and Y. But I don't understand its reference to Avro.

Still better, can you give a small example of what you are trying to do?

Thank you,

Thiru

________________________________
 From: Thomas Dressel <th...@uni-weimar.de>
To: dev@avro.apache.org 
Sent: Monday, 24 June 2013 7:10 PM
Subject: Forward Declaration
 

Hello,

I've searched the web and the Documentation of Avro, but I didn't get  
an answer.
So I write this email to you, with the question, if Avro does support  
forward declaration?

I look forward to hearing from you soon.


Yours faithfully,

Thomas Dressel