Skip to content

Inconsistent naming of types and their associated commands and SyntaxShapes #10332

Closed

Description

@sholderbach

We have a few "types" where the naming is not perfectly consistent across the user facing interface:

  • The commands specific to the type (e.g. date now)
  • The Type name accessible through describe (e.g. 1.0 | describe float)
  • The SyntaxShape i.e. the thing you can cue the parser to which is the thing the type annotations in defs are turned into (e.g. def foo [bar: datetime])
  • Documentation inside and outside the application when referring to that.

On top of that our internal symbols should follow the same names for better discoverability.

✔️ decimal -> float

Here the direction to move is obvious as float is more true to what the capabilities of the underlying data type is (not money-safe, fast for approximate math)

Details as this is DONE

Status copied from #10320 (comment)

date vs datetime

This is more contentious: date has a nice brevity for the command names but the capabilities for time are expressed by datetime

  • date ... family of commands (effectively the methods/class functions :P)
  • format date as the corresponding format command
  • into datetime as the cast
  • seq date for sequence generation
  • Type::Date
  • date now | describe returns date (rename date type to datetime #10298)
  • SyntaxShape::DateTime
  • For command arguments : datetime
  • date as the thing to style in the config (see StyleComputer)
  • (Dataframes make a distinction between the two types: dfr as-date and dfr as-datetime)
  • FlatShape::DateTime
  • Expr::DateTime
  • Category::Date

✔️ int and integer

Details as this is DONE
h/t @1Kinoti

bool and boolean

TODO

$nothing/null and nothing

See #9973 and #9918

Addendum Path

To the user the distinction between Type and SyntaxShape is probably not strictly obvious. We should also try to get them as close as possible. Here a notable outlier is for example :path is SyntaxShape::Path that enables important completions but doesn't exist inside the Type/Value system

Activity

  1. added
    category:meta-issue
    A:type-system
    naming-things 🚲 🛖
    on Sep 12, 2023
  2. fdncred commented on Sep 12, 2023

    @fdncred
    Contributor

    I'd add FlatShape and Expr in general but more specifically FlatShape::DateTime, and Expr::DateTime. All our enums should be in sync for better understanding.

    Just a listing of enums to check.

    nu-protocol

    • Category
    • SyntaxShape
    • Type
    • Expr
    • Value

    nu-parser

    • FlatShape
  3. sholderbach commented on Sep 12, 2023

    @sholderbach
    MemberAuthor

    Feel free to expand the checklist above, we certainly should update the internals as well with the priority to user or user tooling facing stuff (e.g. that the ide extensions still work etc.)

  4. amtoine commented on Sep 12, 2023

    @amtoine
    Member

    wow, thanks for that @sholderbach 🙏

  5. 1Kinoti commented on Sep 27, 2023

    @1Kinoti
    Contributor
  6. added a commit that references this issue on Oct 3, 2023
  7. kronberger-droid commented on Nov 14, 2026

    @kronberger-droid
    Contributor

    The type names are consistent by now: float, int, bool and datetime, with $nothing gone.
    What is left is the naming of the date commands, which never got decided.

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

    A:type-systemcategory:meta-issuenaming-things 🚲 🛖

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions