HomePhorge

(PUP-3680) Remove confusing convenience Hash[value-type]
dc5d6300dfa2Unpublished

Unpublished Commit · Learn More

Repository Importing: This repository is still importing.

Description

(PUP-3680) Remove confusing convenience Hash[value-type]

In an attempt to be helpful, the type system offers a convenience
that if a Hash type is specified with one key, then this is taken
as being the type of the value (and the key type defaults to
Scalar).

In practice this proved to be confusing as it raises the question
about if it is the key type or the value type that is being
specified. Some users thought it was they key type, as that is
what they wanted control over, others thought it was the value type.

From a consistency standpoint (a Hash is a Collection), it could
be viewed as being a collection of Tuple[Key, Value], but implementing
that is not very helpful (it is just more to type). The best solution is
therefore to simply remove the convenience and require both Key and
Value type as a minimum. (This also removes the confusion over the error
if wanting to specify Hash[Value, 2,5] (which fails because 2 is not a
type). Now users have to specify the full type: Hash[Key, Value, 2, 5]
if they want to add min and max entries.

Event Timeline

Henrik Lindberg <henrik.lindberg@cloudsmith.com> committed rPUdc5d6300dfa2: (PUP-3680) Remove confusing convenience Hash[value-type] (authored by Henrik Lindberg <henrik.lindberg@cloudsmith.com>).Dec 2 2014, 2:13 AM