Slice semantics was: Re: Herb Sutter briefly discusses D during interview
Ali Çehreli
acehreli at yahoo.com
Wed Jun 8 10:59:59 PDT 2011
On 06/08/2011 10:38 AM, Ali Çehreli wrote:
> If we need to think about what
> the compiler does or how a specific language feature is implemented,
> that language is a failed abstraction. D is not. There shouldn't be any
> need to get into implementation details to describe a language feature.
>
> This used to happen with D slices: some people would point to pictures
> of slices where .ptr pointed to the beginning of some elements in
> memory. That way of describing slices would not work on beginners who
> have no idea on what a pointer is, especially in a language where
> pointers can be avoided for a long time.
Allow me to contradict myself: I've tried to pinpoint the semantics of
D's slices in the past, but have failed. I remember focusing on
"discretionary sharing semantics."
The apparent non-deterministic behavior related to non-stomping makes it
hard ("impossible" for me) to describe the semantics of slices. Steve
had to get into implementation details in his "D Slices" article to
describe that non-determinism. I think that strengthens my view that
slices cannot be fully described without getting into implementation
details.
Ali
More information about the Digitalmars-d
mailing list