PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Re: python-style decorators
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: python-style decorators

Réponse
 
LinkBack Outils de la discussion
Vieux 16/09/2007, 13h02   #1
Matteo Gottardi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: python-style decorators

On Sep 5, 12:15 am, "Keith Rarick" <k...@essembly.com> wrote:
[....]
> The real problem is that ruby provides no way to intercept method
> definitions as they occur. The best you can do is notice that they
> happen after the fact.

what about http://blog.ntecs.de/articles/2004/0...rators-in-ruby
? This seem a very useful feature to have in ruby 2.0

  Réponse avec citation
Vieux 17/09/2007, 20h58   #2
Keith Rarick
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: python-style decorators

On 9/16/07, Matteo Gottardi <gomatteo@gmail.com> wrote:
> what about http://blog.ntecs.de/articles/2004/0...rators-in-ruby
> ? This seem a very useful feature to have in ruby 2.0


Interesting. As long as we're willing to modify the ruby interpreter,
why not just implement real decorators? There are some problems with
my interface (and the one described on ntecs.de) that I was willing to
live with in a pure ruby implementation. First, it's not very DRY as
each decorator needs logic to lookup and replace the method and return
its name. It's also a little fragile. Most importantly, though,
replacing the method *after* it's been defined isn't as clean as
wrapping the method object right before it gets bound to a name. Any
method_added hooks will, unfortunately, be called twice.

I'm not personally going to try getting a ruby patch accepted.

kr

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 16h24.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09825 seconds with 10 queries