Provide a new alias for Any, dedicated for use as a placeholder, thus reserving Any for situations when truly every type is acceptable.

Description

When adding type annotations to code that was previously untyped, it's often useful to do so in stages. A common early step is to use Any liberally to avoid getting stuck figuring out the "best" type for a Var. (For example, see this pull request, in which clojure.zip/zipper is given the type [Any Any Any Any -> (Vec Any)].)

The problem is that there's no way to tell whether a given occurrence of Any is functioning as a temporary placeholder, or whether it's expressing the fact that truly every value is acceptable.

I propose a new alias for Any that will enable users to distinguish between these two usages. I don't feel strongly about the name of the alias, but in the absence of other suggestions I nominate Dunno because it concisely expresses the phrase "I don't know".

Environment

None

Activity

Show:
Josh Tilles
November 11, 2015, 5:18 PM

A possible further enhancement would be trivial TFn (or even a no-op macro) for making temporary types that are more specific than Any but still indicate the need for further refinement. I’ve been using Approx in my own work.

Ambrose Bonnaire-Sergeant
November 11, 2015, 6:09 PM

Cool idea. At least in the core library, the annotations should be "safe", that zipper annotation looks too permissive to me.

Perhaps we need a clojure.core.typed.scratch namespace for dirty transitions from untyped to typed.

Ambrose Bonnaire-Sergeant
December 3, 2017, 10:45 PM

Unclear how to proceed.

Declined

Assignee

Ambrose Bonnaire-Sergeant

Reporter

Josh Tilles

Labels

None

Approval

None

Patch

None

Priority

Minor