Interesting but the "Isn't this just multiple return?" section seems to completely miss the point. I don't see any examples of what multiple-return would look like. And multiple-return is what I want.
At first glance, it looks like this (sure, more powerful) pattern matching system is not going to satisfy my desire for a compact syntax that lets me do the equivalent of this typescript:
I think the best thing we have is the new `record` feature. You can declare a small public record before the method with the return type, and by using the `var` keyword, the caller doesn't need to repeat the type declaration.
I use the lombok plugin with IntelliJ, it eliminates tedious parts of some code.
Some times one needs to create new objects return multiple related items from a function. Or use a collection or array. I think it is unnecessary. Other languages (e.g. go or python) have had this for a while now. I taking a wild guess here LISP probably had it since the 1970s.
carimura|4 years ago
[1] https://github.com/openjdk/amber-docs/blob/master/site/desig...
stickfigure|4 years ago
At first glance, it looks like this (sure, more powerful) pattern matching system is not going to satisfy my desire for a compact syntax that lets me do the equivalent of this typescript:
muhammedbash|4 years ago
In go you can do this:
function (x, y int) (sum, prod int) { return x+y, x*y }
It makes a big difference when one is using the same input to generate multiple related outputs.
Cojen|4 years ago
bgruber|4 years ago
MichaelMoser123|4 years ago
muhammedbash|4 years ago
Some times one needs to create new objects return multiple related items from a function. Or use a collection or array. I think it is unnecessary. Other languages (e.g. go or python) have had this for a while now. I taking a wild guess here LISP probably had it since the 1970s.