Re: L2R/R2L syntax (was Re: Everything is an object.)
Luke Palmer writes: > I don't think so. Rather, that becomes: > > him.hit(I); > > And to clarify, you should probably format it like this: > > hit him: I; > > But computer languages aren't generally used to specify past tense > anyway > why priperties are sort of ... because they tell the state of the thing as a result of some action that happend ( prbably in very close ) past : him.hit(I); # him is being hit by me; him is hit(I); # him was hit by me -- and this has some consequences !!! it seems that some times "is" may be replaced by "was" him was initialized ; :-) arcadi
Re: Array Questions
Luke Palmer wrote: > I would imagine that would only work if $a was known at compile time: I think we could do it at runtime too. You could conceivably use runtime resolution to, for example, choose from between several different caching behaviors to be passed to a complex routine: sub get_cached_foo( HashImplementor $implementor ) {# syntax??? my %foo is $implementor; ... return \%foo; } my $foo = &get_cached_foo( LRU_Cache ); That should be OK... we have to know what C<$implementor> is when we actually do the C, but it doesn't have to be known at compiletime. My only concern with this particular example: my $a = MyCache; # (1) $a contains a class identifier my %b is $a; # (2) vs. my $a = 'MyCache'; # (3) $a contains a string my %b is $a; # (4) is that 1-2 should work as intended, but 3-4 probably doesn't... because in (3) $a is just a string, *not* a class. Since a string instance doesn't implement the interface to be a Scalar implementor, (4) would give a runtime error. So I *think* the first example should work, and the second example should not. > Actually, that's quite a difficult question; is MyScalar a > property or a behavior class? Is there a difference, or is the latter > a subset of the former? Yeah. In the words of another cartoon character, "I *don't* know." :-/ MikeL
Re: "Disappearing" code
Damian Conway wrote: sub debug is immediate is exported (@message) { return $debugging ?? { print $*STDERR: @message; } :: {;} } Won't @message need lazy evaluation? How will Perl know to delay interpolation until the result of the "macro" is called at run time? - Ken
Re: "Disappearing" code
Ken Fox wrote: Won't @message need lazy evaluation? How will Perl know to delay interpolation until the result of the "macro" is called at run time? Good point. It would also need to be slurped. So that's: sub debug is immediate is exported (*@message is lazy) { return $debugging ?? { print $*STDERR: @message; } :: {;} } Damian