20-03-2011, 12:42 AM
Pour le chaînage niahoo je ne sais pas, je te donne la réponse demain je ferais des tests, là je vais aller me coucher ;D
Concernant le côté implicit, voici un extrait d'une doc pdf à ce sujet (en anglais) :
There’s a fundamental difference between your own code and libraries of
other people: you can change or extend your own code as you wish, but if
you want to use someone else’s libraries, you usually have to take them as
they are.
A number of constructs have sprung up in programming languages to
alleviate this problem. Ruby has modules, and Smalltalk lets packages add
to each other’s classes. These are very powerful, but also dangerous, in that
you modify the behavior of a class for an entire application, some parts of
which you might not know. C# 3.0 has static extension methods, which are
more local, but also more restrictive in that you can only add methods, not
fields, to a class, and you can’t make a class implement new interfaces.
Scala’s answer is implicit conversions and parameters. These can make
existing libraries much more pleasant to deal with by letting you leave out
tedious, obvious details that obscure the interesting parts of your code. Used
tastefully, this results in code that is focused on the interesting, non-trivial
parts of your program. This chapter shows you how implicits work, and
presents some of the most common ways they are used.
Et une mini doc pour te montrer pourquoi c'est trop classe les implicit conversion :
http://www.codecommit.com/blog/ruby/impl...mic-typing
Concernant le côté implicit, voici un extrait d'une doc pdf à ce sujet (en anglais) :
There’s a fundamental difference between your own code and libraries of
other people: you can change or extend your own code as you wish, but if
you want to use someone else’s libraries, you usually have to take them as
they are.
A number of constructs have sprung up in programming languages to
alleviate this problem. Ruby has modules, and Smalltalk lets packages add
to each other’s classes. These are very powerful, but also dangerous, in that
you modify the behavior of a class for an entire application, some parts of
which you might not know. C# 3.0 has static extension methods, which are
more local, but also more restrictive in that you can only add methods, not
fields, to a class, and you can’t make a class implement new interfaces.
Scala’s answer is implicit conversions and parameters. These can make
existing libraries much more pleasant to deal with by letting you leave out
tedious, obvious details that obscure the interesting parts of your code. Used
tastefully, this results in code that is focused on the interesting, non-trivial
parts of your program. This chapter shows you how implicits work, and
presents some of the most common ways they are used.
Et une mini doc pour te montrer pourquoi c'est trop classe les implicit conversion :
http://www.codecommit.com/blog/ruby/impl...mic-typing