`stdlib` `string_type` `parameter` array currently possible?

Making the internal representation public creates some interesting aliasing issues for at least the assignment(=) operator:

type(string_type) :: str
str = str%raw

Exposing the raw representation allows to hack around some issues, but it also introduces new ones. In particular, we lose the memory safety introduced by string_type as the raw value can always be unallocated.

Also, for the specific use case of using the default constructor, the allocatable attribute is the actual problem, which can’t be mended by making the raw representation public.

2 Likes