Re:The eero programming language - a dialect of Objective-C
by ender7 on Saturday July 07, 2012 @11:04AM
(#4211787)
I've never understood why people like frontal return types. It seems to me that the most important piece of a function is its name, which 50% of the time will make it obvious what its return type is anyway. Also, certain languages such as C++ (and occasionally Java) have a habit of involving incredibly long return types that push the actual function name far off to the side, if not onto a second line.
[ Parent
| on HN ]
Re:The eero programming language - a dialect of Objective-C
by cageface on Saturday July 07, 2012 @11:35AM
(#4211878)
In C++11 you can push the return type to the right, like this:
auto foo(int x) -> bool;
Re:The eero programming language - a dialect of Objective-C
by akkartik on Saturday July 07, 2012 @04:15PM
(#4212599)
Ewww. WTF?!
http://www.cprogramming.com/c++11/c++11-auto-decltype-return... provides a rationale: so you don't have to type in ClassName:: twice. Is that really worth this monstrosity? The function name is still not at the start of the statement. '->' is being horribly misused. Anybody know if there's a better reason for this? Did the committee really have nothing better to think about?
Re:The eero programming language - a dialect of Objective-C
by kzrdude on Saturday July 07, 2012 @08:34PM
(#4213157)
Yes there are much better reasons: http://www2.research.att.com/~bs/C++0xFAQ.html#suffix-return
template<class T, class U>
auto mul(T x, U y) -> decltype(x*y)
{
return x*y;
}