On Apr 15, 10:56 pm, RickB <rbiel...@xxxxxx> wrote:
| Quote: |  | |
|
> But even here, there must be a place to store it, meaning the integer
> must be a property on some object associated with every single step in
> every single pipeline of every user everywhere, just because you
> don't feel like adding a counter to the step where you happen to need
> counts.
| |
| | |
Simple - store the integer as a member of the Cmdlet class. The memory
(and cpu) overhead would be minuscule.
And you're focusing on the wrong thing - you're considering this as
though it were a counter of objects. My suggestion for $% would be a
counter of operations on objects, a logical supplement to $_. And
just like $_ it is transient and provides transient information while
processing the pipeline - but this information can then be used
wherever beneficial. Your arguments against it would equally apply to
$_ itself!
| Quote: |  | |
|
> You could even create a step in your pipeline that attaches a noteproperty
> to each object with it's sequence. Then you would have it everywhere
> without even having to maintain counters everywhere.
| |
| | |
Granted that annotating the objects themselves, as you have suggested,
is trivial enough, but doing so addresses a somewhat different use
case. It's also a very expensive operation.
What I'm suggesting is massively cheaper, in terms of both cpu and
memory, (vanishingly so in fact), is trivial to implement, is highly
generic and provides a feature that is directly analogous to one of
the most commonly used in other text processing languages. (such as
'NR' in awk) It's usefulness in such languages is proven and
incontrovertible.
What I'm suggesting isn't going to change the world because, and, yes,
the effect can be simulated in other ways, but at either much greater
cost or significant inconvenience. However improving the feature-set
of a product such as powershell involves comparing the cost of a
feature to the possible usefulness. I'm suggesting provide easily
accessible information about the activity of the pipeline which
typically relates to a "real-world" meaning of the entities that are
being processes, and does so with virtually no cost.
All your arguments have been centered on misunderstandings that have
led you to be inappropriately concerned about a performance hit that
doesn't exist.
And arguing, as you have done, that a feature has no usefulness
because you don't do the kinds of operations where it would be useful
is like saying no one could possibly have a need for Excel because all
you do is write letters.
Michael