Skip to content

Concept: use explicit None for empty parameters instead of eg RangeExpr() #465

Description

@ducky64

The default provides a concrete default value (typically ideal, eg, RangeExpr.ALL), while an explicit None means not-set.

Helps limit proliferation of internal constructs through the external API.

Likely requires defining RangeLike and friends as Optional, allowing None to be passed through the chain.

Problems:

  • No longer provides type information in the object itself
  • In some cases, can be solved using an explicit cast-like op at use sites eg RangeExpr(arg), especially within ArgParam
    • This makes sense in Block definitions
    • Shifting the explicit cast into the library definition probably makes sense, to make the API cleaner
  • Is this also as clear for port definitions?
    Related? More accurate constructor argument typing #98

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions