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

Logos Improvements #5

Open
DHowett opened this issue Apr 13, 2013 · 11 comments
Open

Logos Improvements #5

DHowett opened this issue Apr 13, 2013 · 11 comments
Labels
enhancement New feature or request

Comments

@DHowett
Copy link
Contributor

DHowett commented Apr 13, 2013

@DHowett
Copy link
Contributor Author

DHowett commented Jun 2, 2013

I have no idea what I was doing with this (%log => static function? what?), and that makes me sad. Repurposing as logos improvement bug.

@theiostream
Copy link
Contributor

What is the use case of %append/%prepend?

Also, just figure I'll put it here, find cool %ivar syntax.

@caughtinflux
Copy link

Replace __PRETTY_FUNCTION__ with the corresponding hooked method name, to keep all the $$$ safe, not to mention clarity.

@DHowett
Copy link
Contributor Author

DHowett commented Jun 24, 2013

%group X %init Y %end %end might create _logos_class$_ungrouped$Y.

@caughtinflux
Copy link

For the ivar syntax, would it be possible to simply declare them after a %subclass directive? Like so

%subclass Foo : Bar 
{
    id _fooBar;
}
...
%end

Are there any limitations that prevent Logos from doing this, keeping all the leg work behind the scenes (like everything else it does ;P)?

@DHowett
Copy link
Contributor Author

DHowett commented Jun 24, 2013

Main issue there is that I don't actually parse source. Syntel has a type parser, and it's possible at the very least to get into subclass blocks for ivars (ooh: treat them like syntelstructs! good idea!), but that would ideally be coupled with direct reference to ivar names. And that is dark magic indeed.

@DHowett
Copy link
Contributor Author

DHowett commented Jun 24, 2013

Looked into __PRETTY_FUNCTION__; it's handled as a primary-expression in the C parser. We can unfortunately not get inside it :(

@DHowett
Copy link
Contributor Author

DHowett commented Sep 16, 2013

From #48.

17:22 <@DHowett> that should be being done anyway, come to think of 
             it. however, it complicates custom class expressions
17:22 <@DHowett> as init can wrap scope
17:22 <@DHowett> (the function cannot be variadic, and i do not know 
             what classes the user will want to change
17:22 <@DHowett> actually, that's tractable. i think it can be done)
17:23 <@DHowett> (the static function gets generated at the end, after 
             all. the call can contain all overridden classes)
17:23 <@DHowett> and the prototype and final function as well

@DHowett
Copy link
Contributor Author

DHowett commented Sep 16, 2013

From #10.

The logs config param for logos should exist, and support full, off, and on (defaulting to on). full will automatically %log all hooked methods. off will disable (consume) %log directives.

@DHowett
Copy link
Contributor Author

DHowett commented Sep 16, 2013

From #9 (via @rpetrich).

It should be possible to pass arbitrary expressions into a logos macro and have it dedupe and cache them.
Existing %c(classname) expressions could be converted to use this functionality internally.
Additionally, components within theos itself could use this functionality to trim some of the work they perform (would use this for my internal generator)

Proposed syntax:
%cached(x) yields a C rvalue that references the result of the computation x as executed from inside %init; (or the automatically generated initializer if none exists)

Potential extensions:
Nested cached expressions could be supported to eliminate duplicate work inside of cached expressions themselves. Further, cached expressions that are used only as a subexpression of other cached expressions could be optimized not to escape the scope of %init
Lazy initialization via alternate syntax (with/without thread safety?). Would allow syntax like this to workaround glacial apis:
%cached([[[NSCharacterSet characterSetWithCharactersInString:@"_1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"] invertedSet] retain], lazy)

@nathggns
Copy link

Someone implemented %property in a pull request - #94

@uroboro uroboro transferred this issue from theos/theos Nov 2, 2018
@uroboro uroboro added the enhancement New feature or request label Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants