Ayer en la tarde, Horst von Brand dijo: > blackbeer <[EMAIL PROTECTED]> wrote: > > [...] > >> Polimorfismo es un concepto de OO. [...] > > Polimorfismo /nada/ tiene que ver con OOP. Se refiere a que una operacion > se pueda invocar igual para datos de distinto tipo. [...]
Quizas ambos tienen la razon :) ,----[ <http://c2.com/cgi/wiki?CategoryPolymorphism> ] | Types of polymorphism: | | GenericPolymorphism?, also known as ParametricPolymorphism: Generic | algorithms, templates, parameteric types, etc, [...] | | SubtypePolymorphism?: Polymorphism based on subtyping (the notion that | one type can extend/implement the behavior of another in such fashion | that any valid operation on the supertype is valid on the subtype), | subsumption (allowing a subtype to be used in a context where a | supertype is expected), and DynamicDispatch (selecting a function or | data based on the runtime type of its arguments--see SingleDispatch, | DoubleDispatch, MultipleDispatch (aka MultiMethods)). JavaLanguage, | CeePlusPlus, etc. all have subtype polymorphism [...] `---- > Caso extremo es tal vez lenguajes como Perl, en los que puedes > aplicar la operacion sort a un arreglo de numeros o de strings, y > "hace lo correcto" (ordena numericamente o como string) solo. <nitpicking> Eso no es tan asi; `sort' ordena lexicograficamente (o, al menos, segun lo que LC_COLLATE diga) a menos que se le indique otra forma, tipicamente con una funcion anonima: $ perl -le 'print join(" ", sort @ARGV)' 1 2 3 10 1 10 2 3 $ perl -le 'print join(" ", sort {$a cmp $b} @ARGV)' 1 2 3 10 1 10 2 3 $ perl -le 'print join(" ", sort {$a <=> $b} @ARGV)' 1 2 3 10 1 2 3 10 </nitpicking> Salu2, -- Cristian Gutierrez /* [EMAIL PROTECTED] */ Nothing but perl can parse Perl. -- Tom Christiansen

