Re: Selective exporting of properties/methods
On Sat, 2002-05-11 at 13:58, Chris Dutton wrote: method world is public_to(Bar) { Might as well make that: method world is private(Bar) I tend to take any opportunity to recycle syntax, plus keywords with underscores give me gas. ;)
Re: Selective exporting of properties/methods
On Wednesday, May 15, 2002, at 10:17 AM, Aaron Sherman wrote: On Sat, 2002-05-11 at 13:58, Chris Dutton wrote: method world is public_to(Bar) { Might as well make that: method world is private(Bar) I tend to take any opportunity to recycle syntax, plus keywords with underscores give me gas. ;) I had considered is public(Bar), but this works too.
RE: Selective exporting of properties/methods
Miko O'Sullivan writes: What I've often wanted would be standard method that is called before every subroutine call. If that method returns false then the method that was called is not called. What you're describing is Aspect-Oriented Programming (I think). Take a look around CPAN for Aspect.pm and Hook::LexWrap. [says Mark who has never used AOP but only read about it in Software Development...] === Mark Leighton Fisher[EMAIL PROTECTED] Thomson multimedia, Inc.Indianapolis IN Display some adaptability. -- Doug Shaftoe, _Cryptonomicon_
Re: Selective exporting of properties/methods
While thinking Eiffel-ish thoughts the other day, I began to wonder if Perl6's classes could go beyond the simple private/public/protected scheme by optionally allowing for a property or method to only be accessed by a certain set of classes. Many times when I've used OO languages I've wished for something like this. What I've often wanted would be standard method that is called before every subroutine call. If that method returns false then the method that was called is not called. A standard set of security information is passed in. That could get kind of expensive so the security method is only called if the class is specifically set to use it. Something like this: class Foo::Bar { use Class::Security::Method 'checker'; sub checker (%meta) { if (some_security_check()) {return 1} return 0; } } -Miko
Re: Selective exporting of properties/methods
On Sunday, May 12, 2002, at 02:18 PM, Miko O'Sullivan wrote: While thinking Eiffel-ish thoughts the other day, I began to wonder if Perl6's classes could go beyond the simple private/public/protected scheme by optionally allowing for a property or method to only be accessed by a certain set of classes. Many times when I've used OO languages I've wished for something like this. What I've often wanted would be standard method that is called before every subroutine call. If that method returns false then the method that was called is not called. I think maybe what you're looking for is another Eiffel/Sather-ism. I know Eiffel at least has both pre and post-conditions that look something like this(it's been a while, so if this isn't quite right): class ACCOUNT creation make_with_balance feature { BANK } balance: INTEGER make_with_balance(initial_balance: INTEGER) is require initial_balance = 0 do balance := initial_balance ensure balance = 0 end end I too have thought this might be useful in Perl6. Perhaps... class Account { my INT $balance; method new(INT $initial_balance //= 0) { REQUIRE { $initial_balance = 0; } $.balance = $initial_balance; ENSURE { $.balance = 0; } } }