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

Methods name and field name "init" issue #82

Open
nakajimakotaro opened this issue Nov 16, 2014 · 1 comment
Open

Methods name and field name "init" issue #82

nakajimakotaro opened this issue Nov 16, 2014 · 1 comment

Comments

@nakajimakotaro
Copy link

My environment is ubuntu14.04 dub

this is not compiled

import luad.all;

class Foo
{
    void init() //this is name init
    {
    }
}
void main()
{
    auto L = new LuaState();
    L.set("Foo", new Foo);
}
import luad.all;

class Foo
{
    int init; //this is name init
}
void main()
{
    auto L = new LuaState();
    L.set("Foo", new Foo);
}

this is compiled

import luad.all;

class Foo
{
    void nit() //this is name nit
    {
    }
}
void main()
{
    auto L = new LuaState();
    L.set("Foo", new Foo);
}
import luad.all;

class Foo
{
    int nit; //this is name nit
}
void main()
{
    auto L = new LuaState();
    L.set("Foo", new Foo);
}
@JakobOvrum
Copy link
Owner

init is a special property in D and should never be used as a member name, whether it's a field or a method. There have been talks in the past to make such members illegal. I don't think it's reasonable to expect introspection code like LuaD's to try to handle it.

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

2 participants