in reply to Re: sort hash keys as numbers and maybe even more...
in thread sort hash keys as numbers and maybe even more...

I agree, it would not be easy. Not trying to argue about this, just thinking what the root cause is, other than that Perl does not support strong type.

I am thinking the other important thing contributed to this problem, is that Perl is not really OO. Think in this way, in a OO language, like Java or c++, a list would always contain the virtually the same type of element, even though they might actually be quite different, but you can always use the sort defined on the weakest type, (in Perl, the worst would be go back to the Object class, which is the base for all).

In a OO language, the realization of what is contained in a list, is obviously not a problem.

  • Comment on Re: Re: sort hash keys as numbers and maybe even more...

Replies are listed 'Best First'.
Re:^3: sort hash keys as numbers and maybe even more...
by tall_man (Parson) on Feb 06, 2003 at 00:26 UTC
    Java allows you define arrays of type Object and put whatever you want into them -- good luck sorting those.
    Object fruit[] = new Object[2]; fruit[0] = new Apple(); fruit[1] = new Orange();
Re^3: sort hash keys as numbers and maybe even more...
by adrianh (Chancellor) on Feb 05, 2003 at 23:07 UTC
    I am thinking the other important thing contributed to this problem, is that Perl is not really OO.

    Surely that's a typing issue rather than an OO issue? (e.g. Eiffel & CLOS allow lists/collections of any type and are both "OO". ML types lists and isn't.)