Skip to content

Allow _ for readability in unitized constants like 3_day or 5_gb #9111

@bobhy

Description

@bobhy

Related problem

〉100_000
100000
〉3.141_596_2828
3.1415962828

But not:

〉3day
3day
〉3_day
Error: nu::shell::external_command

  × External command failed
   ╭─[entry #14:1:1]
 1 │ 3_day
   · ──┬──
   ·   ╰── executable was not found
   ╰────
  help: No such file or directory (os error 2)

Describe the solution you'd like

So one could say:

let duration = 3.165_hours
let size = 1.234_567__mb

Using _ for improving readability of numeric constants is a great idea. Why not extend it to unitized constants of all types? Duration, Filesize, (what's the complete list of these?)

Describe alternatives you've considered

No response

Additional context and details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:accessibilityAn issue to make Nushell more accessible to anyonecategory:enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions