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

Major: Obj-C and oj differ when functions/variables inside of @implementation #87

Closed
iccir opened this issue Dec 12, 2015 · 1 comment
Closed

Comments

@iccir
Copy link
Member

iccir commented Dec 12, 2015

Per the oj 0.x and 1.x documentation:

Behind the scenes, the oj compiler changes the @implementation/@EnD block into a JavaScript function block. Hence, private functions and variables may be declared inside of an @implementation without polluting the global namespace.

This differs in behavior from Objective-C. Consider the following:

@interface Foo : NSObject
@end

@implementation Foo
static int sInt = 0;
static void sFoo() { }
int theInt = 0;
void foo() { }
@end

sInt, sFoo, theInt, and foo are all visible/callable from outside of the @implementation block:

int main(int argc, const char * argv[])
{
    sFoo();
    foo();
    sInt = theInt + 4;
    return 0;
}

If changed, this would require a major bump.

Note: I don't think this change should occur for its own sake; rather, it's an ok change to make if #86 requires it.

@iccir
Copy link
Member Author

iccir commented Mar 16, 2023

No longer applicable due to #166

@iccir iccir closed this as completed Mar 16, 2023
@iccir iccir closed this as not planned Won't fix, can't repro, duplicate, stale Mar 16, 2023
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

No branches or pull requests

1 participant