in reply to Perl 6 and Ruby on Rails
Attributesand the class openness stuff: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:
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.class Dog is Mammal { has $.tail is rw; has @.legs; has $:brain; ... }
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 |