Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It might be useful to have an ability to exclude some classes from lazy properties instantiation #5

Merged
merged 2 commits into from
Nov 19, 2013

Conversation

0xc010d
Copy link
Contributor

@0xc010d 0xc010d commented Nov 11, 2013

It was decided to derive <BMLazy> protocol in subclasses and not to require its mentioning in them. Anyhow, sometimes it might be useful to 'skip' lazy properties instantiation for some classes in this hierarchy. So, from now on it's possible to use <BMLazyExclude> protocol to do that. All the properties declared in those 'excluded' classes would not be taken into account when we collect @dynamic properties for lazy instantiation.

Example usage

@interface A : NSObject <BMLazy>
@property (nonatomic, strong) NSObject *a;
@end

@implementation A
@dynamic a;
@end
@interface B : A
@property (nonatomic, strong) NSObject *b;
@end

@implementation B
@dynamic b;
@end
@interface C : B <BMLazyExclude>
@property (nonatomic, strong) NSObject *c;
@end

@implementation C
@dynamic c;
@end

In this hierarchy class A is defined as lazy so its property a would be lazily instantiated. Class B would also be lazy (as it derives <BMLazy> protocol from A) so its property b would be lazily instantiated as well as inherited property a. C is defined as <BMLazyExclude> and inherits B so its property c would not be lazily instantiated while a and b would still be lazily instantiated.

@AlexDenisov
Copy link
Contributor

@0xc010d, could you rebase your fork so I can merge it automatically?

AlexDenisov added a commit that referenced this pull request Nov 19, 2013
It might be useful to have an ability to exclude some classes from lazy properties instantiation
@AlexDenisov AlexDenisov merged commit 0694182 into railsware:master Nov 19, 2013
@AlexDenisov
Copy link
Contributor

Sorry for delay, didn't see notifications =\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants