Windows Vista Forums

Adding canonical aliases for Compare-Object, Measure-Object, New-Object
  1. #1


    Alex K. Angelopoulos [MVP] Guest

    Adding canonical aliases for Compare-Object, Measure-Object, New-Object

    Vote on this, please.

    https://connect.microsoft.com/feedba...edbackID=79879


    Of the 9 object cmdlets, 6 have at least a canonical alias composed from the
    verb:



    ForEach-Object: foreach,%
    Group-Object: group
    Select-Object: select
    Sort-Object: sort
    Tee-Object: tee
    Where-Object: where,?

    Given the central role of object cmdlets and that we also want to provide a
    standard, uniform experience for users, I suggest that the remaining 3
    cmdlets be given aliases based on their verb as well, like this:

    Set-Alias compare Compare-Object
    Set-Alias measure Measure-Object
    Set-Alias new New-Object

    Here's a more detailed justification.

    + It simplifies the aliasing scheme.
    Although this adds 3 aliases, it reduces cognitive load when people are
    trying to understand aliasing. The object cmdlets are already an exception
    to the aliasing system's structure; this makes them internally consistent
    and complete.

    + No issue with conflicts
    If a keyword 'new' is ever introduced, it can be disambiguated by the same
    means as the ForEach-Object alias and the foreach keyword.



      My System SpecsSystem Spec

  2. #2


    Keith Hill [MVP] Guest

    Re: Adding canonical aliases for Compare-Object, Measure-Object, New-Object

    "Alex K. Angelopoulos [MVP]" <a k a @ m v p s . o r g> wrote in message
    news:uKcTvO$fGHA.5104@TK2MSFTNGP04.phx.gbl...
    > Vote on this, please.
    >
    > https://connect.microsoft.com/feedba...edbackID=79879
    >
    >
    > Of the 9 object cmdlets, 6 have at least a canonical alias composed from
    > the verb:
    >
    > ForEach-Object: foreach,%
    > Group-Object: group
    > Select-Object: select
    > Sort-Object: sort
    > Tee-Object: tee
    > Where-Object: where,?
    >
    > Given the central role of object cmdlets and that we also want to provide
    > a standard, uniform experience for users, I suggest that the remaining 3
    > cmdlets be given aliases based on their verb as well, like this:
    >
    > Set-Alias compare Compare-Object
    > Set-Alias measure Measure-Object
    > Set-Alias new New-Object


    I've suggested a "measure" alias for measure-object before. I like the idea
    of providing aliases for the others.

    --
    Keith



      My System SpecsSystem Spec

  3. #3


    dreeschkind Guest

    RE: Adding canonical aliases for Compare-Object, Measure-Object, New-O

    What about the new one-character aliases?
    Do we need canonical one-character aliases, too?

    ForEach-Object: foreach, %
    Group-Object: group, G
    Select-Object: select, S
    Sort-Object: sort, §
    Tee-Object: tee, T
    Where-Object: where, ?
    Compare-Object: compare, C
    Measure-Object: measure, M
    New-Object: new, N

    Yeah, I do like obfuscated code ;-)

    --
    greetings
    dreeschkind

    "Alex K. Angelopoulos [MVP]" wrote:

    > Vote on this, please.
    >
    > https://connect.microsoft.com/feedba...edbackID=79879
    >
    >
    > Of the 9 object cmdlets, 6 have at least a canonical alias composed from the
    > verb:
    >
    > ForEach-Object: foreach,%
    > Group-Object: group
    > Select-Object: select
    > Sort-Object: sort
    > Tee-Object: tee
    > Where-Object: where,?
    >
    > Given the central role of object cmdlets and that we also want to provide a
    > standard, uniform experience for users, I suggest that the remaining 3
    > cmdlets be given aliases based on their verb as well, like this:
    >
    > Set-Alias compare Compare-Object
    > Set-Alias measure Measure-Object
    > Set-Alias new New-Object
    >
    > Here's a more detailed justification.
    >
    > + It simplifies the aliasing scheme.
    > Although this adds 3 aliases, it reduces cognitive load when people are
    > trying to understand aliasing. The object cmdlets are already an exception
    > to the aliasing system's structure; this makes them internally consistent
    > and complete.
    >
    > + No issue with conflicts
    > If a keyword 'new' is ever introduced, it can be disambiguated by the same
    > means as the ForEach-Object alias and the foreach keyword.
    >
    >
    >


      My System SpecsSystem Spec

Adding canonical aliases for Compare-Object, Measure-Object, New-Object problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare-Object and Get the name of object/File? akcorr PowerShell 5 19 Jun 2008
Testing object arrays using Compare-Object and -contains Alex K. Angelopoulos [MVP] PowerShell 2 31 Aug 2006
Default display for measure-object Dave PowerShell 5 23 May 2006
measure-object {get-process} Andrew Watt [MVP] PowerShell 6 22 May 2006
Multiple errors in help for measure-object Andrew Watt [MVP] PowerShell 0 21 May 2006