Skip to content

Should the package be named ziglua? #117

@natecraddock

Description

@natecraddock

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions