Skip to content

Naming conventions for assert commands #8419

Closed

Description

@presidento

Related problem

I like the Nushell naming convetion, I mean here we do not use abbreviations too much. For example we have str substring, not str substr. And so on.

Describe the solution you'd like

Follow the existing naming convention for assert commands in std.nu, while keep the Rust-like abbeviations as aliases. For example have (with alias):

  • assert equal (alias assert eq)
  • assert not equal (alias assert neq)
  • assert less-or-equal (alias assert lte)
  • etc.

Describe alternatives you've considered

Some languages use the abbreviated names for assertions, some use full names. I think with Nushell the full name is more natural.

Additional context and details

This is a follow-up issue from #8405 (comment). Involve @amtoine.

I'll send a PR if we can agree on this.

Activity

  1. added
    A:std-library
    on Mar 12, 2023
  2. amtoine commented on Mar 14, 2023

    @amtoine
    Member

    Some languages use the abbreviated names for assertions, some use full names. I think with Nushell the full name is more natural.

    i agree with this 👍
    nushell might be a bit verbose sometimes, but gains with its completion and in readability 💪

    and as it's a simple change, i think there's no harm in seing how it works with people 😉

  3. presidento commented on Mar 14, 2023

    @presidento
    ContributorAuthor

    Thank you, I'll do it soon, when it is appropriate.

  4. amtoine commented on Mar 15, 2023

    @amtoine
    Member

    Thank you, I'll do it soon, when it is appropriate.

    when you have time 😉

  5. presidento commented on Mar 18, 2023

    @presidento
    ContributorAuthor

    @amtoine Can we even have an alias for a command in a module?

    Let's have a mymodule.nu file with:

    export def mycommand [] { "Hello" }
    export alias myalias1 = mymodule mycommand
    export alias myalias2 = mycommand
    

    None of these alias can be used universally:

    ❯ nu -c 'use mymodule.nu *; mycommand; myalias2; myalias1'
    Hello
    Hello
    Error: nu::shell::external_command (link)
    
      × External command failed
       ╭─[source:1:1]
     1 │ use mymodule.nu *; mycommand; myalias2; myalias1
       ·                                         ────┬───
       ·                                             ╰── did you mean 'module'?
       ╰────
      help: program not found
    

    And

    ❯ nu -c 'use mymodule.nu; mymodule mycommand; mymodule myalias1; mymodule myalias2'
    Hello
    Hello
    Error: nu::shell::external_command (link)
    
      × External command failed
       ╭─[source:1:1]
     1 │ use mymodule.nu; mymodule mycommand; mymodule myalias1; mymodule myalias2
       ·                                                         ────────┬────────
       ·                                                                 ╰── command 'mycommand' was not found but it was imported from module 'mymodule'; try using `mymodule mycommand`
       ╰────
      help: program not found
    
  6. amtoine commented on Mar 18, 2023

    @amtoine
    Member

    it appears not 🤔
    i'm having the same kind of errors!

  7. amtoine commented on Mar 18, 2023

    @amtoine
    Member

    i'd drop the alias idea for now and let the user do it.

    in the meantime, that might give a nice improvement in a feature request 😉

  8. added a commit that references this issue on Mar 20, 2023
    7d96377
  9. added this to the v0.78.0 milestone on Mar 21, 2023
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:std-librarycategory:enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions