Dan Sugalski wrote:
>
> There won't be any direct access to attributes outside class methods
> of the class that defines the attributes, unless Larry changes his
> mind in a big way. (And, honestly, probably not even then) Instead
> it'll all be accessed via lvalue methods. If an attribute is exposed
> there's just an lvalue method created, if it's not exposed there
> isn't.
Ack! Hold on, there: I'm being told that Damian thinks lvalues are
probably out, and that Larry thinks that pseudo-attributes will be made
accessed through the use of lvalues. Please confirm, which is it? I
don't particularly care, I just want to write an example down in
best-guess form.
Now, second question: if slots are in, that means that there is
fundamentally no difference between a method and attribute. (This is a
Very, Very Good Thing.) Will there be a _syntactic_ difference? e.g.
class Zap { # style "A"
attr $sfoo = 5; # scalar
attr %kfoo = { key => value }; # hash(?)
method sbar { ... code ... }; # method
}
- vs something like -
class Zap { # style "B"
method sfoo = 5; # scalar
method kfoo = { key => value }; # hash(?)
method sbar { ... code ... }; # method
}
- or like -
class Zap { # style "C"
slot $sfoo = 5; # scalar
slot %kfoo = { key => value }; # hash(?)
slot $sbar = method { ... code ... }; # method
}
MikeL