{"action":"created","issue":{"url":"https://api.github.com/repos/bartbes/Class-Commons/issues/5","labels_url":"https://api.github.com/repos/bartbes/Class-Commons/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/bartbes/Class-Commons/issues/5/comments","events_url":"https://api.github.com/repos/bartbes/Class-Commons/issues/5/events","html_url":"https://github.com/bartbes/Class-Commons/issues/5","id":78612743,"number":5,"title":"Class Commons \"2.0\"","user":{"login":"bartbes","id":60183,"avatar_url":"https://avatars.githubusercontent.com/u/60183?v=3","gravatar_id":"","url":"https://api.github.com/users/bartbes","html_url":"https://github.com/bartbes","followers_url":"https://api.github.com/users/bartbes/followers","following_url":"https://api.github.com/users/bartbes/following{/other_user}","gists_url":"https://api.github.com/users/bartbes/gists{/gist_id}","starred_url":"https://api.github.com/users/bartbes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartbes/subscriptions","organizations_url":"https://api.github.com/users/bartbes/orgs","repos_url":"https://api.github.com/users/bartbes/repos","events_url":"https://api.github.com/users/bartbes/events{/privacy}","received_events_url":"https://api.github.com/users/bartbes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-20T17:15:29Z","updated_at":"2015-07-28T09:08:01Z","closed_at":null,"body":"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.\r\n\r\nI 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.\r\n\r\nIf anyone else has ideas, or proposals, please do share, I think we should generally strive to keep the specification as stable as possible.\r\n\r\nWithout further ado:\r\n- 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.\r\n- A class commons user uses `pcall(require, \"class.commons\")` to find its implementation.\r\n- 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.\r\n\r\nThis means we can get rid of both globals, and package.loaded/require are used as direct replacements."},"comment":{"url":"https://api.github.com/repos/bartbes/Class-Commons/issues/comments/125512475","html_url":"https://github.com/bartbes/Class-Commons/issues/5#issuecomment-125512475","issue_url":"https://api.github.com/repos/bartbes/Class-Commons/issues/5","id":125512475,"user":{"login":"bartbes","id":60183,"avatar_url":"https://avatars.githubusercontent.com/u/60183?v=3","gravatar_id":"","url":"https://api.github.com/users/bartbes","html_url":"https://github.com/bartbes","followers_url":"https://api.github.com/users/bartbes/followers","following_url":"https://api.github.com/users/bartbes/following{/other_user}","gists_url":"https://api.github.com/users/bartbes/gists{/gist_id}","starred_url":"https://api.github.com/users/bartbes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartbes/subscriptions","organizations_url":"https://api.github.com/users/bartbes/orgs","repos_url":"https://api.github.com/users/bartbes/repos","events_url":"https://api.github.com/users/bartbes/events{/privacy}","received_events_url":"https://api.github.com/users/bartbes/received_events","type":"User","site_admin":false},"created_at":"2015-07-28T09:08:01Z","updated_at":"2015-07-28T09:08:01Z","body":"To keep it all central, I'll comment in this ticket:\r\n\r\n- I'm not a fan of having a \"Class Commons\" file that people need to include, the point of class commons was that it would just work™ (though whether it was successful is another matter altogether).\r\n- I'm not sure how your register function would actually do anything, it doesn't change anything about the passed function, and, importantly, doesn't make the class \"native\", it just stuffs it in a table somewhere.\r\n- In fact, it seems like you're aiming to support multiple class libraries in the codebase, which is exactly what class commons is trying to prevent."}}