You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
Explicit casting will make this proposal break backward-compatibility with existing Go 1.x code because some parts of the standard library could to be rewritten to actually make use of the new immutability feature, which would cause existing Go 1.x code fail compiling in a newer compiler version with immutable type support.
The built-in append function should, for example, be rewritten, to make use of the immutability feature, in the following way:
This is necessary to make append guarantee not touching any of the inputs excepts the given slice (but not the Type's inside the slice). But this would break all existing Go 1.x code, because it would then require explicit type casting:
v:= []int {1, 2, 3}
// The "old" way of using append will stop working:v=append(v, 4, 5) // Compile-time error// The "new" way would be:v=append(const(v), const(4), const(5)) // Compile-time error
Proposal Redesign
In order to avoid breaking backward-compatibility implicit casting must be proposed instead.
The text was updated successfully, but these errors were encountered:
Explicit casting will make this proposal break backward-compatibility with existing Go 1.x code because some parts of the standard library could to be rewritten to actually make use of the new immutability feature, which would cause existing Go 1.x code fail compiling in a newer compiler version with immutable type support.
The built-in
append
function should, for example, be rewritten, to make use of the immutability feature, in the following way:This is necessary to make
append
guarantee not touching any of the inputs excepts the given slice (but not theType
's inside the slice). But this would break all existing Go 1.x code, because it would then require explicit type casting:Proposal Redesign
In order to avoid breaking backward-compatibility implicit casting must be proposed instead.
The text was updated successfully, but these errors were encountered: