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

Add a no argument case to println! #995

Closed
zaeleus opened this issue Mar 20, 2015 · 6 comments
Closed

Add a no argument case to println! #995

zaeleus opened this issue Mar 20, 2015 · 6 comments

Comments

@zaeleus
Copy link

zaeleus commented Mar 20, 2015

Currently, println! requires an empty string to print an empty line to stdout, i.e, println!(""). I propose an empty argument case for convenience, i.e., println!(). This simply prints a newline.

The idea stems from languages like Java (System.out.println()), Ruby (IO#puts), etc. that do this.

cc @bombless

@bombless
Copy link

I like this idea.
panic! already has similar thing for this.
See https://github.com/rust-lang/rust/blob/master/src/libcore/macros.rs#L14-L16

@mellypop
Copy link

This seems logical to me.

@bombless
Copy link

If we can call println! without round brackets, I think it will be very cool.
I'm tweaking the parser to see if we can do that ideally. If it works out I'll post a new RFC.

@pyfisch
Copy link
Contributor

pyfisch commented Apr 8, 2015

Please not. I always liked that macros look like a function.

@bombless
Copy link

bombless commented Apr 9, 2015

I already have a working implementation and it works well.
Anyway I think it should be post-phone so I just plan to write a RFC around May.

I'll cc you to invite you show your exact idea at that time, @pyfisch .
:)

@zaeleus
Copy link
Author

zaeleus commented Dec 22, 2016

This was implemented by rust-lang/rust#36825 and stablized in 1.14.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants