Afficher un message
Vieux 12/03/2008, 01h41   #7
Robert Dober
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Best practices for Ruby Meta-programming

On Tue, Mar 11, 2008 at 10:40 PM, John Carter <john.carter@tait.co.nz> wrote:
> On Tue, 11 Mar 2008, Robert Dober wrote:
>
> > def attr_reader *atts
> > atts.each do |att|
> > define_method att do instance_variable_get "@#{att}" end
> > end
> > end
> >
> > is definitely for the programmer, it also should rather run at runtime
> > than at compile time.

>
> This topic is about Best Practices for Meta-Programming.
>
> And you have just handed me a brilliant example of why human readable
> intermediate representation _is_ Best Practice...
>
>
> Hmm. Is
> attr_read :foo
> really equivalent to a plain getter?

Semantically yes, for the implementation
I have no idea, it is probably written in C. The point is what it is good for.
R.
>
>
> John Carter Phone : (64)(3) 358 6639
> Tait Electronics Fax : (64)(3) 359 4632
> PO Box 1645 Christchurch Email : john.carter@tait.co.nz
> New Zealand
>
>
>




--
http://ruby-smalltalk.blogspot.com/

---
Whereof one cannot speak, thereof one must be silent.
Ludwig Wittgenstein

  Réponse avec citation
 
Page generated in 0,05970 seconds with 9 queries