Assigning string values to string values or byte[] to byte[] does not
require additional memory allocation.
But conversion between string and byte[] does so most of the time, because
the underlying array of a string is immutable, versus the mutable of a
byte[].
Encapsulating the type cast
Ian Lance Taylor schrieb am Dienstag, 23. März 2021 um 23:22:51 UTC+1:
> On Tue, Mar 23, 2021 at 3:19 PM atd...@gmail.com
> wrote:
> >
> > Since, we also know the type of v, It would be infered from it.
> >
> > There is no variance, no dependent type... Meaning that the type of a Go
>
Am 22.03.2021 um 10:10 schrieb Martin Leiser:
Am 21. März 2021 22:01:38 MEZ schrieb Ian Lance Taylor :
On Sun, Mar 21, 2021 at 1:02 PM Martin Leiser
wrote:
...
import "container/list" stringlist type ElementType = string
What if I want to have a list of lists
Am 21. März 2021 22:01:38 MEZ schrieb Ian Lance Taylor :
>On Sun, Mar 21, 2021 at 1:02 PM Martin Leiser
>wrote:
>>
>> I think so. But How? Remember we need to do two things:
>>
>> - A way to define type parameters.
>>
>> - A way to bind the ty
" yet, but it should
be possible to add this for typical functional libraries such as
"sort.go <https://golang.org/pkg/sort/>".
- type bindings my even be transitive, if the binding type is itself
a exported interface type.
So the a full fledged proposal may end up a
xis generic collections are the far more
important aspect than functional libraries containing "Min" and "Max"
functions.
And your writing was all about collections too.
Thank a lot for Your suggestions!
Martin Leiser
On Sun, Feb 7, 2021 at 9:20 PM Martin Leiser <mailt
he types you actually want to use with them with.
It is a simple "opt in" approach. You add a type binding on import, that's
it. For the "generic" type in the package: Give a name to your types, which
helps for readability anyway.
And big thanks for your good writeup of the ex