Skip to content

Function naming convention or member functions #1

Open
@Avokadoen

Description

@Avokadoen

It can be a bit cumbersome to find the functions you want when using zmath since the function names are not necessarily tied to the type it relates to and are not members of said type. The zmath.zig file is 4k lines of code and tests are intertwined which makes it harder to get an overview of what is there.

As an example, the identity function for a Mat is called identity while for quaternions it is called qidentity.

In this case I do think that it would make more sense to have midentity & qidentity, mat_identity & quat_identity or Mat.identity & Quat.identity. I do understand that the library does try to not avoid unnecessary abstractions. I think zmath can be improved so that it is easier to quickly find the functions that operate on certain types while keeping abstractions at a minimum. Splitting operations that tie to a certain construct i.e Vec, Mat and Quat (and a common.zig for f32xX + common functions) into struct files could also solve this problem.

Keep in mind that this problem should not be high priority and zmath is very usable as is, but I think this discussion can make it even more usable 👀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions