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

Implicitly capturing this in a closure fails in the C++ compiler #1256

Open
weltschildkroete opened this issue Nov 12, 2022 · 1 comment
Open

Comments

@weltschildkroete
Copy link
Contributor

The following code

struct Foo {
    public message: String

    public function print_message(this) {
        let captures_this = function() {
            println(this.message)
        }

        captures_this()
    }
}

gives a error: 'this' cannot be implicitly captured in this context in the C++ compiler, when it should probably just fail in the jakt compiler.

@awesomekling
Copy link
Contributor

Indeed, it looks like we don't validate captures at all right now.
Definitely an area that needs improvement :)

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

No branches or pull requests

2 participants