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

Should the package be named ziglua? #117

Open
natecraddock opened this issue Oct 23, 2024 · 1 comment
Open

Should the package be named ziglua? #117

natecraddock opened this issue Oct 23, 2024 · 1 comment

Comments

@natecraddock
Copy link
Owner

natecraddock commented Oct 23, 2024

https://github.com/ziglang/zig/blob/2d888a8e639856e8cb6e4c6f9e6a27647b464952/lib/init/build.zig.zon#L2-L9

    // This is the default name used by packages depending on this one. For
    // example, when a user runs `zig fetch --save <url>`, this field is used
    // as the key in the `dependencies` table. Although the user can choose a
    // different name, most users will stick with this provided value.
    //
    // It is redundant to include "zig" in this name because it is already
    // within the Zig package namespace.
    .name = "$",

Zig says that using the word zig in the package name is redundant. But is this actually helpful?

Let's say we rename it to lua. Then by default the dependency code would look like this in a build.zig

const lua = b.dependency("lua", .{
    .target = target,
    .optimize = optimize,
});

People are always welcome to rename things in the .zon file, but will they?

But with that, the module name is still ziglua, so the build file would continue as

// add the ziglua module
exe.root_module.addImport("ziglua", lua.module("ziglua"));

Maybe this should be exe.root_module.addImport("lua", lua.module("lua"));?

But I really like naming my Lua.init() variable lua, and I don't want that to conflict. Not sure what to do here.

Lurking in Discord, it seems like ziglua is sometimes referenced as an example of how a Zig project is structured. This is probably because Zig doesn't have great docs and most of us are just looking at what everyone else is doing.

So

  • Should the package be named ziglua?
  • Should the module be named ziglua?

For clarity I believe the repo should be named ziglua. This makes it clear the purpose of the project and makes it searchable.

@robbielyman
Copy link
Collaborator

I think there's a case for keeping the name ziglua: given the existence of pushAny and so forth, the project is now more than simply bindings to the C API that rename functions. Also, as far as I know you're not part of the lua.org organization, so keeping the name separate is useful for that reason too.

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