David L. Nicol wrote:
> sub DirectBubbleSort(){
> my ($i,$t) = (-1,0);
> while (++$i <= $#$__){
> $$__[$i] > $$__[1+$i] and $t++ and @$__[$i,1+$i] = @$__[1+$i,$i];
> };
> $t and @$__ = DirectBubbleSort;
> }
>
> @SomeList = DirectBubbleSort; # instead of DirectBubbleSort(\@SomeList)
>
If I saw a module like this, I wouldn't use it ever! I think I would even
`undef' all my variables explicitly before using them as lvalues, just in
case... Serious, man, that is a sick mind!
And I don't see what the problem with DirectBubbleSort(\@SomeList) is. It's
rather explicit, and is very clear about what is done. Using a (\@)
prototype on DirectBubbleSort would be ok too, since its name says right
what it does and everybody likes some vanilla syntax. But making it
@SomeList = DirectBubbleSort is the most error-prone thing I see! Nobody
will get it right on first use...
- Branden