ceylon/ceylon-spec — Issue #180: Shortcut syntax for print()
Author: gavinking
Created: 2012-02-19 02:29:19+00:00
State: open
Labels: feature, request for feedback

Thinking about the needs of stuff like the Web Runner and scripting, I realized that it sort of sucks that you can't just write stuff like `12**0.5;` and get Ceylon to print the result. Actually, I find myself typing `print(foo);` quite often and wishing for a shortcut. Two possibilities occurred to me:

1. A new operator, the most promising possibilities would seem to be `=>` or `out` (which is already a keyword).

out 12**0.5;

or:

=> 12**0.5;
2. Simply interpreting a string literal that occurs by itself as an invocation of `print()`.

"" 12** 0.5 "";

So helloworld would look like:

void hello() {
out "Hello, World!";
}

or:

void hello() {
=> "Hello, World!";
}

or:

void hello() {
"Hello, World!";
}

Thoughts?