Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

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

Reply
 
Old 05-25-2006   #1 (permalink)
Alex K. Angelopoulos [MVP]


 
 

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
Old 05-25-2006   #2 (permalink)
Keith Hill [MVP]


 
 

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
Old 05-26-2006   #3 (permalink)
dreeschkind


 
 

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
Reply

Thread Tools


Similar Threads
Thread Forum
Compare-Object and Get the name of object/File? PowerShell
Problem with Measure-Object on get-process PowerShell
Testing object arrays using Compare-Object and -contains PowerShell
Default display for measure-object PowerShell
measure-object {get-process} PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46