From: Ian Lance Taylor <i...@google.com>
Date: Thu, 11 Nov 2010 14:39:32 -0800
Local: Thurs, Nov 11 2010 5:39 pm
Subject: Re: [go-nuts] Re: Function accepting a slice of interface types.
Scott Pakin <scott+...@pakin.org> writes: But there is a real difference. Assigning a string to x[2] fails at > On Nov 10, 8:14 pm, Nigel Tao <nigel.tao.gn...@gmail.com> wrote: >> That might work for reads, but I don't think it works for writes. To >> repeat my earlier example, what should this program do: >> ------------- >> x := make([]int, 3) >> f looks like a perfectly reasonable function, since string satisfies > I'd think it should fail. x has a concrete type with a known layout compile time. Assigning a string to z[2] only fails at run time. One aspect of Go is that it carefully indicates which operations can fail at run time. E.g., a simple assignment can never fail at runtime. A type assertion can. Failing to maintain that clear distinction between compile time failures Ian You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||