Using C# as an example, extensions on
IEnumerable to allow code like
collection.Each(i => i.DoStuff) rather than a
foreach loop are generally frowned upon, mainly because they don't follow LINQ conventions of being functional, in that the functions they take are statements rather than expressions, written to have side-effects.
Does the same thing apply to an extension to allow code like...
10.times(() => ThingIWantToDo10Times())
On one hand it's still clearly not functional, but on the other, it's not an extension on
Would an extension like this be frowned upon for the same reasons?