Re: [dev-servo] JS guide

2014-03-05 Thread Simon Sapin
On 04/03/2014 22:33, Josh Matthews wrote: I've started a guide to try and clear up how to use them; please feel free to suggest further topics or make edits yourself:https://github.com/mozilla/servo/wiki/JS-smart-pointers The guide says: Downcasting is an unsafe operation, so you must be conf

Re: [dev-servo] JS guide

2014-03-05 Thread Niko Matsakis
Note: the first PR related to overloadable deref has landed. This means that the `get()` and `get_mut()` methods can go away and be replaced with an overloaded `*` operator. For now, the derefs must be explicit. I'm still reviewing the second part of this work, which integrates with auto-deref. B

Re: [dev-servo] JS guide

2014-03-04 Thread Patrick Walton
On 3/4/14 8:32 PM, Josh Matthews wrote: I was actually thinking that we could rewrite methods that look like this: fn TakesANode(node: &JS) to read as follows: fn TakesANode(node: &JS) { let node: JS = NodeCast::from(node); That would enable passing any Node-derived type as a parameter; un

Re: [dev-servo] JS guide

2014-03-04 Thread Josh Matthews
On 03/04/2014 10:27 PM, Boris Zbarsky wrote: On 3/4/14 5:33 PM, Josh Matthews wrote: I know that some contributors have expressed confusion about the new JS types that are all over the DOM. I've started a guide to try and clear up how to use them; please feel free to suggest further topics or ma

Re: [dev-servo] JS guide

2014-03-04 Thread Boris Zbarsky
On 3/4/14 5:33 PM, Josh Matthews wrote: I know that some contributors have expressed confusion about the new JS types that are all over the DOM. I've started a guide to try and clear up how to use them; please feel free to suggest further topics or make edits yourself: https://github.com/mozilla/

Re: [dev-servo] JS guide

2014-03-04 Thread Boris Zbarsky
On 3/4/14 7:31 PM, Robert O'Callahan wrote: Even when you just need instanceof, can it be shortened to if (HTMLTitleElement::hasInstance(element)) ? Note that in Gecko that instanceof check would be: element->IsHTML(nsGkAtoms::title) While there are more longhand ways to decompose the ch

Re: [dev-servo] JS guide

2014-03-04 Thread Robert O'Callahan
On Wed, Mar 5, 2014 at 12:55 PM, Josh Matthews wrote: > It can be, but there are cases when that would be wasted effort. I'm open > either way. In XPCOM terms, the vast majority of QueryInterface calls do more with the returned pointer than a null check. So I think you'll find it well worthwhile

Re: [dev-servo] JS guide

2014-03-04 Thread Brendan Eich
Josh Matthews wrote: It can be, but there are cases when that would be wasted effort. Sure, but if there are cases where the one-liner wastes no effort, it wins. I'm open either way. Both, sounds like. /be ___ dev-servo mailing list dev-servo@lis

Re: [dev-servo] JS guide

2014-03-04 Thread Josh Matthews
On 03/04/2014 06:09 PM, Robert O'Callahan wrote: On Wed, Mar 5, 2014 at 11:33 AM, Josh Matthews wrote: I know that some contributors have expressed confusion about the new JS types that are all over the DOM. I've started a guide to try and clear up how to use them; please feel free to suggest f

Re: [dev-servo] JS guide

2014-03-04 Thread Robert O'Callahan
On Wed, Mar 5, 2014 at 11:33 AM, Josh Matthews wrote: > I know that some contributors have expressed confusion about the new JS > types that are all over the DOM. I've started a guide to try and clear up > how to use them; please feel free to suggest further topics or make edits > yourself: https:

[dev-servo] JS guide

2014-03-04 Thread Josh Matthews
I know that some contributors have expressed confusion about the new JS types that are all over the DOM. I've started a guide to try and clear up how to use them; please feel free to suggest further topics or make edits yourself: https://github.com/mozilla/servo/wiki/JS-smart-pointers Cheers,