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
- Re: assign to magic name-of-function variable instead of... Damian Conway
- Re: assign to magic name-of-function variable instead of... Damian Conway
- Re: assign to magic name-of-function variable inste... Jarkko Hietaniemi
- Re: assign to magic name-of-function variable instead of... John Porter
- Re: assign to magic name-of-function variable inste... David L. Nicol
- Re: assign to magic name-of-function variable instead of... abigail
- Re: assign to magic name-of-function variable instead of... abigail
- Re: assign to magic name-of-function variable instead of... David L. Nicol
- Re: assign to magic name-of-function variable instead of... Glenn Linderman
- Re: assign to magic name-of-function variable instead of... Damian Conway
- Re: assign to magic name-of-function variable inste... Edward Peschko
- Re: assign to magic name-of-function variable inste... Glenn Linderman
- Re: assign to magic name-of-function variable inste... Johan Vromans
- Re: assign to magic name-of-function variable instead of... abigail
- Re: assign to magic name-of-function variable instead of... James Mastros
- Re: assign to magic name-of-function variable instead of... John Porter
