void type

View: New views
8 Messages — Rating Filter:   Alert me  

void type

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

the 2nd AMF0 test in the echo example sends the 'undefined' value to  
PyAMF and it's being returned with null. The test succeeds but I'm  
not sure if this is a bug in the comparison logic of the echo example  
or whether AMF is not able to read a 'void' from an AMF message.

In the PyAMF source the ASTypes.UNDEFINED is marked as todo:
http://pyamf.org/browser/pyamf/trunk/pyamf/amf0.py?rev=415#L168

Furthermore the ASTypes.UNSUPPORTED currently reads in null but I  
suggest this also returns void/undefined in Flash as well as in Python.

Is there a 'void' type in Python? Maybe we could supply something  
better to Python and return a proper void to Flash, or am I missing  
something here..

Thijs


Re: void type

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

>
> Furthermore the ASTypes.UNSUPPORTED currently reads in null but I  
> suggest this also returns void/undefined in Flash as well as in  
> Python.

I guess we haven't tested the unsupported astype yet since the echo  
example doesn't send any unknown datatypes (like MovieClip) at the  
moment? If you can confirm this I'll create a new ticket for that new  
test in the echo example.

Thijs


Re: void type

by Nick Joyce :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Unsupported types on the Python side are being tested, things like function types can't be encoded so are being sent as the unsupported type.

On receiving an unsupported type via AMF, the current implementation is to set the type to None. I can see now that that probably wasn't the wisest of choices, because when coming to encode time, a different type is used.

In AMF3, there is the notion of unsupported, whereas with AMF0, there is undefined. Do they mean the same thing (because semantically, they do not)? Do we keep these as separate types or munge them together and refer to it in both implementations?

A possible solution would be to create an 'UNSUPPORTED' variable in pyamf.__init__.py that is an instance of object() and set any types to that object upon reading the relevant type when decoding.

Thoughts/alternatives?

On Tue, 2007-11-27 at 20:58 +0100, Thijs Triemstra | Collab wrote:
Hi,

>
> Furthermore the ASTypes.UNSUPPORTED currently reads in null but I  
> suggest this also returns void/undefined in Flash as well as in  
> Python.

I guess we haven't tested the unsupported astype yet since the echo  
example doesn't send any unknown datatypes (like MovieClip) at the  
moment? If you can confirm this I'll create a new ticket for that new  
test in the echo example.

Thijs
_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev

Re: void type

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Nick,

On Nov 27, 2007, at 9:14 PM, Nick Joyce wrote:

> Unsupported types on the Python side are being tested, things like  
> function types can't be encoded so are being sent as the  
> unsupported type.
>
> On receiving an unsupported type via AMF, the current  
> implementation is to set the type to None. I can see now that that  
> probably wasn't the wisest of choices, because when coming to  
> encode time, a different type is used.

Ah! Are you opening a ticket for that?

> In AMF3, there is the notion of unsupported, whereas with AMF0,  
> there is undefined. Do they mean the same thing (because  
> semantically, they do not)? Do we keep these as separate types or  
> munge them together and refer to it in both implementations?

 From the Essential AS3 book:

" The Null and void datatypes each include a single value only - null  
and undefined, respectively. Both null and undefined conceptually  
represent the absence of data. The null value represents the absence  
of data for variables, parameters, and return values with a specified  
type annotation set to anything to but Boolean, int, uint, and  
Number. By contrast, the undefined value represents the absence of  
data for variables, parameters, and return values without a specified  
type annotation. The undefined value also represents the complete  
absence of a variable or method on an object whose class is defined  
as dynamic."

void returns undefined in actionscript, and I think currently PyAMF  
returns null instead of undefined cause otherwise we would see 'void'  
as response type instead of 'null' right?

Thijs


Re: void type

by Nick Joyce :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Tue, 2007-11-27 at 22:08 +0100, Thijs Triemstra | Collab wrote:
Hi Nick,

On Nov 27, 2007, at 9:14 PM, Nick Joyce wrote:

> Unsupported types on the Python side are being tested, things like  
> function types can't be encoded so are being sent as the  
> unsupported type.
>
> On receiving an unsupported type via AMF, the current  
> implementation is to set the type to None. I can see now that that  
> probably wasn't the wisest of choices, because when coming to  
> encode time, a different type is used.

Ah! Are you opening a ticket for that?
Not yet ...

> In AMF3, there is the notion of unsupported, whereas with AMF0,  
> there is undefined. Do they mean the same thing (because  
> semantically, they do not)? Do we keep these as separate types or  
> munge them together and refer to it in both implementations?

 From the Essential AS3 book:

" The Null and void datatypes each include a single value only - null  
and undefined, respectively. Both null and undefined conceptually  
represent the absence of data. The null value represents the absence  
of data for variables, parameters, and return values with a specified  
type annotation set to anything to but Boolean, int, uint, and  
Number. By contrast, the undefined value represents the absence of  
data for variables, parameters, and return values without a specified  
type annotation. The undefined value also represents the complete  
absence of a variable or method on an object whose class is defined  
as dynamic."
There is no notion of 'void' in Python, 'None' is the closest equivalent. I think that setting to 'None' in the case of dynamic classes is the correct thing to do, but am unsure how to map these to the undefined/supported type rather than the null type.

void returns undefined in actionscript, and I think currently PyAMF  
returns null instead of undefined cause otherwise we would see 'void'  
as response type instead of 'null' right?
That is correct and it really, should be failing because of that. Perhaps we should update the EchoTest to check for that?

Thijs
_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev

Re: void type

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Nick,

On Nov 27, 2007, at 10:35 PM, Nick Joyce wrote:

There is no notion of 'void' in Python, 'None' is the closest equivalent. I think that setting to 'None' in the case of dynamic classes is the correct thing to do, but am unsure how to map these to the undefined/supported type rather than the null type.
void returns undefined in actionscript, and I think currently PyAMF  
returns null instead of undefined cause otherwise we would see 'void'  
as response type instead of 'null' right?
That is correct and it really, should be failing because of that. Perhaps we should update the EchoTest to check for that?

I opened a ticket for this: http://pyamf.org/ticket/98

Thijs

Re: void type

by Nick Joyce :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Weird,

I didn't receive an email from tickets@... for this.

Did anyone else?

On Wed, 2007-11-28 at 00:15 +0100, Thijs Triemstra | Collab wrote:
Hi Nick,

On Nov 27, 2007, at 10:35 PM, Nick Joyce wrote:


There is no notion of 'void' in Python, 'None' is the closest equivalent. I think that setting to 'None' in the case of dynamic classes is the correct thing to do, but am unsure how to map these to the undefined/supported type rather than the null type.
void returns undefined in actionscript, and I think currently PyAMF  
returns null instead of undefined cause otherwise we would see 'void'  
as response type instead of 'null' right?
That is correct and it really, should be failing because of that. Perhaps we should update the EchoTest to check for that?


I opened a ticket for this: http://pyamf.org/ticket/98


Thijs
_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev

Re: void type

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That is strange. I received a message from the list and it's also archived [1]. I disabled the 'always send update to ticket owner/updater' option in Trac a few days ago btw, so you don't get duplicate emails anymore.

Thijs


On Nov 28, 2007, at 12:22 AM, Nick Joyce wrote:

Weird,

I didn't receive an email from tickets@... for this.

Did anyone else?

On Wed, 2007-11-28 at 00:15 +0100, Thijs Triemstra | Collab wrote:
Hi Nick,

On Nov 27, 2007, at 10:35 PM, Nick Joyce wrote:


There is no notion of 'void' in Python, 'None' is the closest equivalent. I think that setting to 'None' in the case of dynamic classes is the correct thing to do, but am unsure how to map these to the undefined/supported type rather than the null type.
void returns undefined in actionscript, and I think currently PyAMF  
returns null instead of undefined cause otherwise we would see 'void'  
as response type instead of 'null' right?
That is correct and it really, should be failing because of that. Perhaps we should update the EchoTest to check for that?


I opened a ticket for this: http://pyamf.org/ticket/98


Thijs
_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev
_______________________________________________
PyAMF dev mailing list - dev@...