Skip to content

Class Commons "2.0" #5

@bartbes

Description

@bartbes

Class Commons has been fixed for a while now, and perhaps it's time to shake it up a little, fix our grievances, and clean it up.

I had some ideas regarding a new, cleaner interface. In particular, the ugliest wart of Class Commons, in my opinion, is that it relies on globals. I have devised a way around this, but it also has this wonderfully hacky feel to it, so I welcome all feedback.

If anyone else has ideas, or proposals, please do share, I think we should generally strive to keep the specification as stable as possible.

Without further ado:

  • A class commons implementation inspects package.loaded["class.commons"], if it does not exist it provides it, as if it were the common table from before.
  • A class commons user uses pcall(require, "class.commons") to find its implementation.
  • Local fallback implementations for users are allowed (as before) and encouraged (maybe? that sounds like a lot of duplicate work), but shall remain local to that user. That is, if there is no class commons implementation already available, a library using class commons shall not provide one to anything but itself.

This means we can get rid of both globals, and package.loaded/require are used as direct replacements.

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