Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Mozilla has JavaScript documentation written with IDL

Reading documentation about fileReader, and find out that they write methods using void operator, like this:

void readAsArrayBuffer (
        in Blob blob
);

just trying understand why they do write it like this? If there is any practical use of this syntax?

Later on it turns out not to be js at all, but IDL which is Interface Description Language.

FYI: before asking this question I do google and read about actual void operator in JS. So please there no needs reffer me back. Question little bit blurry, but it has to deal with, why Mozilla has documentation about JavaScript written like this? In IDL which has little with actual JavaScript?

like image 334
dmi3y Avatar asked Dec 08 '12 00:12

dmi3y


1 Answers

Mozilla uses IDL for in two ways

  • Web IDL: used in W3C specifications and such to describe Javascript APIs. These are the normative specifications.

  • XPCOM internal IDL dialect: The native Javascript APIs are implemented in C++. In Gecko's (Firefox's engine's) case, specifically in domain specific framework called XPCOM

As the linked page states, Gecko internally describes interfaces in language neutral IDL dialect, because those interface must be implemented both in native run-time (C++) and Javascript engine (Javascript).

In this case the IDL description is either copy-paste from the orignal Web IDL specification or from Gecko's internal implementation.

like image 199
Mikko Ohtamaa Avatar answered Oct 18 '22 09:10

Mikko Ohtamaa