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>
Hi,   
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;
switch(type){  
  
//The undefined value
case("Undefined"):
// The IDL value is an object reference to a special object that represents the ECMAScript undefined value.
idlType = undefined;  
break;
…


}

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.   

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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:05 UTC