Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upconsole.log should print all its arguments #5495
Comments
|
This will require addressing the note at http://mxr.mozilla.org/servo/source/components/script/dom/webidls/Console.webidl#14 and updating the implementation in |
|
Hey, I'd love to give this a try! I'm new to Rust, though, and I don't see any way to do varargs in Rust; how would we handle an arbitrary number of arguments? |
|
I also was interested in taking a crack at this, when I asked in IRC what it would take to use an arbitrary number of args, all I got was that I could try a slice. Not much in the documentation makes reference to slices except that you can create them from arrays... so not much to go on there... I'm assuming that the solution is not something manual/limited like: |
|
Yeah, I figured in the Rust code you'd need to take some sort of collection as the only arg. In that case, I would appreciate some pointers on how to handle the webidl, because in javascript we still want to use varargs, and I assume we'll need to specify exactly how to do the transform. |
|
Sorry I wasn't clear - WebIDL variadic arguments are expressed like so: http://mxr.mozilla.org/servo/source/components/script/dom/webidls/TestBinding.webidl#305 . The corresponding Rust method is passed a vector, like so: http://mxr.mozilla.org/servo/source/components/script/dom/testbinding.rs#326 |
|
This is now documented: http://doc.servo.org/script/dom/bindings/index.html#rust-reflections-of-webidl-types. |
There's no spec, but I think it's what all other browsers do.