On 04/19/2016 08:37 PM, Ehsan Akhgari wrote:
> As far as I understand, the js namespace is used internally in
> SpiderMonkey, and the JS namespace contains the public API symbols.
> However, I occasionally come across things in the public headers in
> namespace js that I need to use.  Examples include js::GCPolicy,
> js::RootedBase, js::GetBuiltinClass, and js::Unbox.
> 
> Is there any significance to these names being under namespace js rather
> than JS?

No.  People are just sometimes slackers about putting things in the right 
namespace.  That and, sometimes we have gunky garbage APIs that we don't quite 
want to anoint as likely to remain relatively consistent in the long run, so we 
put them in namespace js rather than JS, until such time as we 
rigorize/systematize them better.

> Does that mean that these are not supposed to be used as external
> APIs?

They're available to be used.  Tho sometimes, on a case-by-case basis you are 
not expected to understand, we would rather you not.  GCPolicy, RootedBase, and 
GetBuiltinClass are reasonably not-frowned-upon.  Unbox is slightly dodgier but 
is okayish (or at least we'll fix you up if and when we modify it).  That might 
possibly be better served by Boolean/Number/String/Symbol-specific methods to 
extract the primitive from objects of such types.

Jeff
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to