Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console.log should print all its arguments #5495

Closed
kmcallister opened this issue Apr 2, 2015 · 6 comments
Closed

console.log should print all its arguments #5495

kmcallister opened this issue Apr 2, 2015 · 6 comments

Comments

@kmcallister
Copy link
Contributor

@kmcallister kmcallister commented Apr 2, 2015

There's no spec, but I think it's what all other browsers do.

@jdm
Copy link
Member

@jdm jdm commented Apr 2, 2015

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 components/script/dom/console.rs.

@aneeshusa
Copy link
Member

@aneeshusa aneeshusa commented Apr 3, 2015

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?

@machineloop
Copy link

@machineloop machineloop commented Apr 3, 2015

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:
16 void debug(DOMString message1, DOMString message2, DOMString message3, DOMString message4);
17 void info(DOMString message1, DOMString message2, DOMString message3, DOMString message4);
18 void warn(DOMString message1, DOMString message2, DOMString message3, DOMString message4);
19 void error(DOMString message1, DOMString message2, DOMString message3, DOMString message4);

@aneeshusa
Copy link
Member

@aneeshusa aneeshusa commented Apr 3, 2015

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.

@jdm
Copy link
Member

@jdm jdm commented Apr 3, 2015

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

@jdm jdm added A-content/dom and removed A-content/script labels Apr 3, 2015
@Ms2ger
Copy link
Contributor

@Ms2ger Ms2ger commented Apr 3, 2015

@jdm jdm added the C-assigned label Apr 3, 2015
@boghison boghison mentioned this issue Apr 3, 2015
Manishearth added a commit that referenced this issue Apr 4, 2015
@Ms2ger Ms2ger closed this in c8c7962 Apr 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants
You can’t perform that action at this time.