{"issue":{"created_at":"2011-11-23T02:43:51Z","state":"open","updated_at":"2011-12-02T13:06:13Z","comments":2,"user":{"gravatar_id":"db33090541526c03c798f82aa0a5dbaa","id":97227,"url":"https://api.github.com/users/lifesinger","avatar_url":"https://secure.gravatar.com/avatar/db33090541526c03c798f82aa0a5dbaa?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"lifesinger"},"body":"\r\n1. 思考当前的插件机制是否完善。\r\n1. 添加如何开发插件的文档。\r\n\r\n","assignee":null,"id":2325967,"labels":[{"color":"DDDDDD","name":"improvement","url":"https://api.github.com/repos/seajs/seajs/labels/improvement"}],"number":136,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"Perfect plugin mechanism","closed_at":null,"html_url":"https://github.com/seajs/seajs/issues/136","url":"https://api.github.com/repos/seajs/seajs/issues/136","milestone":null},"action":"created","comment":{"created_at":"2011-12-02T13:06:13Z","updated_at":"2011-12-02T13:06:13Z","user":{"gravatar_id":"db33090541526c03c798f82aa0a5dbaa","id":97227,"url":"https://api.github.com/users/lifesinger","avatar_url":"https://secure.gravatar.com/avatar/db33090541526c03c798f82aa0a5dbaa?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"lifesinger"},"body":"最近看了 Ruby 和 NodeJS 的一些扩展机制，我还是倾向于目前的方式，保持开放，让插件扩展自身而不是限制性预留接口，这样能让系统的“可扩展性”更佳。这对底层稳定的系统来说，是很合适的。比如模块加载器，以后大修改的概率很小，就如 NodeJS 的模块系统一样，成型后，改动的可能性极小。（除非有突破性的发展，在这种情况下，预留钩子也不靠谱）\r\n\r\nRequireJS 的方式，也没什么不妥。但我觉得最难忍受的是，require.js 的源码里，有不少是专为插件写的，这些代码与核心代码关系不大，应该属于 userland 领域的，放在模块加载器的核心代码里，感觉很不妥。也正是因为这个原因，导致 RequireJS 代码比较多，而且有时得为某些插件去修改源码，感觉很别扭。\r\n\r\n\r\n\r\n","id":2989734,"url":"https://api.github.com/repos/seajs/seajs/issues/comments/2989734"}}