sentinels & who owns the value space Re: valhalla-dev Digest, Vol 17, Issue 10

Thomas W at
Fri Dec 18 09:46:34 UTC 2015

I'm going to agree with Vitaly here.

[requiring a Sentinel Factory passed into constructor ripples all over the
API, making it more cumbersome to use]
> Another reason is that then the code depends on an external party to
> generate good sentinels for its internal use. What is a ?good sentinel
> value? is an implementation detail that might have to be documented. As
> client is only concerned with generating real values for its own uses and

The definition of a 'good sentinel value', is a value the client doesn't

The idea of dynamic sentinels seems complicated & marginal to me. If you
did, it would have to be with regard to the Client's value space. Strategy
is an obvious & correct answer.

> Scribbling some random bits over their type seems worse.

Can't work reliably.

What you're proposing would break information theory; client unaware of any
restrictions on value space and collection picking random sentinels, is
essentially hoping that "randomness" will somehow enable you to convey more
information than a byte can hold.

Reliable use of sentinels needs to contract an agreed 'allowable' value
space, or use allocation (for reference types) to obtain a unique one.


More information about the valhalla-dev mailing list