immutable(ubyte)[] to receive

Ali Çehreli acehreli at
Thu Jan 20 21:23:22 UTC 2022

There is a workaround that makes more sense to me.

On 1/20/22 01:38, Alexey wrote:

 >              (immutable(Buffer[]) h)

That requires not only that the elements are immutable but also the 
array is immutable. Although that may exactly be what is required, I 
suspect what actually meant is:

1) I want an array of immutable(Buffer)

2) I would like to be protected from modifying it by accident

The same can be achieved by the following two options as well:

a)             (const immutable(Buffer)[] h)

b)             (in immutable(Buffer)[] h)

The latter is better especially when compiled with -preview=in.

It may very well be a Phobos bug but what I prefer above also seems to 
be a workaround in this case. :)


More information about the Digitalmars-d mailing list