W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2012

any type conversion

From: Marcos Caceres <marcosscaceres@gmail.com>
Date: Mon, 19 Mar 2012 19:08:42 +0000
To: public-script-coord <public-script-coord@w3.org>
Message-ID: <9D5ECE9A22B84678A54C742E3CCF00F9@gmail.com>
I started trying to implement the WebIDL "4.2. ECMAScript type mapping", but got stuck:(  

The terminology of the spec seems a little confused (or I'm just confused) between types defined in WebIDL and terminology used in ECMAScript5.  

This is as far as I was able to get...

function convertAny(value){
Since the IDL any type is the union of all other IDL types, it can correspond to any ECMAScript value type.
How to convert an ECMAScript value to an IDL any value depends on the type of the ECMAScript value:

var type = ECMAScript.Type(value);  
var idlType;
//The undefined value
// The IDL value is an object reference to a special object that represents the ECMAScript undefined value.
idlType = undefined;  


I don't know what you mean by an object reference to a "special object"? And clearly, the above code doesn't seems achieve anything useful… So I'm not able to understand what you want me to implement there:(   
Also, it's confusing that the algorithm is not written in terms of types (i.e., values derived from Type(x) in ECMAScript). If it was, may make things a bit more clear.   

Received on Monday, 19 March 2012 19:09:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:05 UTC