agree with Korshak above
In fact T L's experience reminds me very much of probably my first
experience with go .. I had read the specification completely, and I
thought 'thoroughly' - then immediately tried this
: https://play.golang.org/p/or1Ikhr4en
package main
import (
"fmt"
)
func main() {
var (
x, y, z *string = new(string), new(string), new(string)
b []*string
)
str := "please parse this"
b = make([](*string), 3)
fmt.Sscan(str, x, y, z)
fmt.Sscan(str, b...) //doesn't work
fmt.Println("x", *x, "y", *y, "z", *z)
fmt.Println("b", b)
}
the compile error is of course "*cannot use b (type []*string) as type
[]interface {} in argument to fmt.Sscan*" -
variadics are clear example of why allowing the suggested type conversion
on slices of convertible types would actually be useful..
I've been tempted to request this before, but in the end just moved on.
(maybe there's an obvious way to accomplish the above I've missed ?)
[aide] Doing/allowing type conversions on other type literals is probably a
BAD idea - structs for example coul/would rapidly become difficult - the
beginnings of the types of problems possible is easily represented with
this simple 'program' https://play.golang.org/p/dmDty3iTk0 - would A and B
be considered convertable - trivial on inspection by a human, but difficult
to program for - even more so with additional layers of redirection, with
definition loops - looks like a difficult thing to parse, with little, no,
or negative benefits -mostly massive opportunities for confusion.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.