in reply to Perl 6 and Ruby on Rails

Here are the relevant parts of S12 regarding automatic generation of accessors:

Attributes

Attributes are stored an an opaque datatype, not in a hash. Not even the class has to care how they're stored, since they're declared much like ordinary variables. Instead of my, use has:

class Dog is Mammal { has $.tail is rw; has @.legs; has $:brain; ... }
Public attributes have a secondary sigil of dot, indicating the automatic generation of an accessor method of the same name. Private attributes use a colon to indicate that no public accessor is generated. Some traits are copied to the accessor method. The rw trait causes the generated accessor to be declared rw, making it an lvalue method. The default is a read-only accessor.
and the class openness stuff:
Classes are open and non-final by default, but may easily be closed or finalized by an application if nobody issued an explicit compile-time request that the class stay open or non-final.

Regarding "Passing code blocks around as macros", you have no better choice than to read S4, which pretty much answers your question, though, I am not sure the exact syntax to mimic the behavior you refer to. In my understanding, Perl 6 blocks and subs are just continuations, which opens up some neat generalizations here.

Regarding your comments on Python, I can not really help you here: I pretty much like Python, but every time I decide to use it for some specific tasks, I always end up with a nice Perl script...:-)

rg0now

Replies are listed 'Best First'.
Re^2: Perl 6 and Ruby on Rails
by Joost (Canon) on Apr 05, 2005 at 11:33 UTC
Re^2: Perl 6 and Ruby on Rails
by mattr (Curate) on Apr 05, 2005 at 16:56 UTC
    Thank you *very* much rg0now. I see, the mixed in roles are neat, and the trait verbs look quite powerful and intuitive. Looks like you can get methods from other languages since the PyDict layout is noted. And that smart match ("~~") on meta methods not only looks like a new Japanese smiley but seems like it could be really useful. Since S2 talks about mutability and macros it looks like just about anything would be possible in the future, even a language that looked like English prose. Certainly I'm looking forward to studying more about Perl 6! (And thanks Joost I'll look more at Lexical::Attributes for practice.)