Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread L Godioleskky
OK ...I now see the wisdom of why Go does not allow my simple example...Thanks ALL for you help on this On Wed, Aug 7, 2019 at 12:46 PM Adrian Ho wrote: > On 7/8/19 9:44 PM, lgod...@gmail.com wrote: > > f( g() ) compiles when g returns exactly the number of args that f() > > requires, but if g(

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread Adrian Ho
On 7/8/19 9:44 PM, lgod...@gmail.com wrote: > f( g() ) compiles  when g returns exactly the number of args that f() > requires, but if g() returns only 1/2 that number  f (g(), g() ) wont > compile !! ...Is this not a Golang absurdity  ?? On the contrary, it's a good example of Go's pragmatism, al

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread Robert Engels
I’m not sure that is the best argument. If it was a major change most likely the return types have changed as well, especially if new values are added, and thus it still would not compile. > On Aug 7, 2019, at 10:42 AM, Michel Levieux wrote: > > It avoids confusion AND silent errors. Imagine

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread Michel Levieux
It avoids confusion AND silent errors. Imagine you have: func f() (int, int) func g() (int, int) func h(int, int, int, int) int And somewhere in your code this line appears: v = h(f(), g()) But for some reason, someday you need to change your code and now your function f and g have the followin

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread howardcshaw
On Wednesday, August 7, 2019 at 8:45:18 AM UTC-5, lgo...@gmail.com wrote: > > f( g() ) compiles when g returns exactly the number of args that f() > requires, but if g() returns only 1/2 that number f (g(), g() ) wont > compile !! ...Is this not a Golang absurdity ?? > >> >> Eh. Certainly abs

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread Ian Lance Taylor
On Wed, Aug 7, 2019 at 6:45 AM wrote: > > f( g() ) compiles when g returns exactly the number of args that f() > requires, but if g() returns only 1/2 that number f (g(), g() ) wont compile > !! ...Is this not a Golang absurdity ?? No. It avoids confusion. In case you missed Adrian's reply

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread lgodio2
f( g() ) compiles when g returns exactly the number of args that f() requires, but if g() returns only 1/2 that number f (g(), g() ) wont compile !! ...Is this not a Golang absurdity ?? On Tuesday, August 6, 2019 at 7:26:46 PM UTC-4, Ian Lance Taylor wrote: > > On Tue, Aug 6, 2019 at 4:14 PM

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-06 Thread Adrian Ho
On 6/8/19 10:07 PM, lgod...@gmail.com wrote: > Here a specific example: > > The following compiles and runs as expected > m1x,m1y := ec.scalarMult(16,28,33)   > m2x,m2y := ec.scalarMult( 1,28,33) > rx,ry := ec.add (m1x,m1y, m2x, m2y) > > > However this stmt :    rx,ry= ec.add(ec.scalarMult(16,28,33

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-06 Thread Ian Lance Taylor
On Tue, Aug 6, 2019 at 4:14 PM wrote: > > ?? Am I wrong in saying that the statements I've submitted conform to "As a > special case, if the return values..." The special case applies to f(g()) only. It does not apply to f(g1(), g2()). Ian > On Monday, August 5, 2019 at 11:38:24 PM UTC-4, L

[go-nuts] Re: Question re fcns that return multiple values

2019-08-06 Thread lgodio2
?? Am I wrong in saying that the statements I've submitted conform to "As a special case, if the return values..." On Monday, August 5, 2019 at 11:38:24 PM UTC-4, L Godioleskky wrote: > > For f1 defined as func f1(k1, k2, k3 int) (x1, x2 int) {..} > and f2 defined as func f2(x,y int) (

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-06 Thread Jan Mercl
On Tue, Aug 6, 2019 at 4:07 PM wrote: > > Here a specific example: > > The following compiles and runs as expected > m1x,m1y := ec.scalarMult(16,28,33) > m2x,m2y := ec.scalarMult( 1,28,33) > rx,ry := ec.add (m1x,m1y, m2x, m2y) > > > However this stmt :rx,ry= ec.add(ec.scalarMult(16,28,33), ec.

[go-nuts] Re: Question re fcns that return multiple values

2019-08-06 Thread lgodio2
Here a specific example: The following compiles and runs as expected m1x,m1y := ec.scalarMult(16,28,33) m2x,m2y := ec.scalarMult( 1,28,33) rx,ry := ec.add (m1x,m1y, m2x, m2y) However this stmt :rx,ry= ec.add(ec.scalarMult(16,28,33), ec.scalarMult( 1,28,33)) gives the following compiler e