other languages.
It appears to me that fmt.Sscan and friends return error if you give a
string such as "1.5" when variable is complex128 for example.
Seems to me that the scanning is overly restrictive, shouldn't it just set
the imaginary part to 0, store the number read into the real part and be
happy? Maybe use flags to indicate how restrictive it should be?
Similarly with a number such as "5i" - here the real part should be set to
0 and the imaginary part should be set to 5.
How about "4 + i" - here the imaginary part should be set to 1.0 and real
part to 4.0 and again it should accept it unless you want it to behave
restrictive.
Now, I would like to argue in favor of changes to fmt but that will
probably not happen any time soon - is there an easy way that I could write
my own Scan function so that I could have it do what I want without having
to copy almost all of the stuff in fmt - many of the functions where the
interesting stuff happens are private to fmt and so I don't really see how
you can change that function without actually having to re-implement quite
a lot of it and how does it work if you try to define your own
func (c * complex) Scan( ss * fmt.ScanState, verb rune) error { /* .... */ }
will go complain that such a function is already defined (in fmt) or will
it use yours over the fmt one if it see both?
--
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 golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.