On Fri, Aug 5, 2016 at 11:21 AM, T L <tapir....@gmail.com> wrote:
>
> For an interface value, its internal values will never change.
> Are there any problems if golang supports constant interface values?

Pedantically, in Go, constants are untyped by default.  It doesn't
make sense to speak of an untyped interface value.  I would describe
what you are asking for as an immutable variable.  I've often thought
that immutable variables would be useful in Go, but since they have to
be initialized it's not that simple.  For example, io.EOF is
initialized using a function call.  That means that it can't actually
be in read-only memory, and of course it's possible to take it's
address.  How do we prevent it from being changed, without introducing
an immutable qualifier into the type system?  It's a complex problem
for which I have no solution.  And the benefits of an immutable
variable aren't all that high.

Ian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to