{"action":"created","issue":{"url":"https://api.github.com/repos/stampit-org/stampit/issues/199","repository_url":"https://api.github.com/repos/stampit-org/stampit","labels_url":"https://api.github.com/repos/stampit-org/stampit/issues/199/labels{/name}","comments_url":"https://api.github.com/repos/stampit-org/stampit/issues/199/comments","events_url":"https://api.github.com/repos/stampit-org/stampit/issues/199/events","html_url":"https://github.com/stampit-org/stampit/issues/199","id":143708638,"number":199,"title":"Private protected API.","user":{"login":"BauchBeinePoe","id":962108,"avatar_url":"https://avatars.githubusercontent.com/u/962108?v=3","gravatar_id":"","url":"https://api.github.com/users/BauchBeinePoe","html_url":"https://github.com/BauchBeinePoe","followers_url":"https://api.github.com/users/BauchBeinePoe/followers","following_url":"https://api.github.com/users/BauchBeinePoe/following{/other_user}","gists_url":"https://api.github.com/users/BauchBeinePoe/gists{/gist_id}","starred_url":"https://api.github.com/users/BauchBeinePoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BauchBeinePoe/subscriptions","organizations_url":"https://api.github.com/users/BauchBeinePoe/orgs","repos_url":"https://api.github.com/users/BauchBeinePoe/repos","events_url":"https://api.github.com/users/BauchBeinePoe/events{/privacy}","received_events_url":"https://api.github.com/users/BauchBeinePoe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-26T14:07:09Z","updated_at":"2016-03-26T14:49:00Z","closed_at":null,"body":"Hey,\r\n\r\nI am missing a private protected API and I would want to start a discussion on that. Or maybe there is already one and I've missed it. \r\n\r\nFor example: If I want to provide objects with a log method, I would do it like so:\r\n\r\n    var log = stampit.init(function () {\r\n    \r\n        this.log = console.log;\r\n\r\n    });\r\n\r\nWhen I create new stamps based on this log stamp these objects could simply call the log method. Simple as that, but the log method is also exposed in the public API where I do not need it.\r\n\r\nAs a suggestion I would rather have it this way:\r\n\r\n    var log = stampit.init(({ instance, stamp }, private) => {\r\n\r\n       private.log = console.log;\r\n\r\n    });\r\n\r\nThis way the private object is not exposed in the public API but can be used by composed stamps.\r\n\r\n    var a = stamp.compose(log).init(({ instance, stamp }, private) => {\r\n        private.log('Some log method');\r\n    }\r\n\r\nWhat do you think?\r\n"},"comment":{"url":"https://api.github.com/repos/stampit-org/stampit/issues/comments/201839122","html_url":"https://github.com/stampit-org/stampit/issues/199#issuecomment-201839122","issue_url":"https://api.github.com/repos/stampit-org/stampit/issues/199","id":201839122,"user":{"login":"koresar","id":1622575,"avatar_url":"https://avatars.githubusercontent.com/u/1622575?v=3","gravatar_id":"","url":"https://api.github.com/users/koresar","html_url":"https://github.com/koresar","followers_url":"https://api.github.com/users/koresar/followers","following_url":"https://api.github.com/users/koresar/following{/other_user}","gists_url":"https://api.github.com/users/koresar/gists{/gist_id}","starred_url":"https://api.github.com/users/koresar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koresar/subscriptions","organizations_url":"https://api.github.com/users/koresar/orgs","repos_url":"https://api.github.com/users/koresar/repos","events_url":"https://api.github.com/users/koresar/events{/privacy}","received_events_url":"https://api.github.com/users/koresar/received_events","type":"User","site_admin":false},"created_at":"2016-03-26T14:49:00Z","updated_at":"2016-03-26T14:49:00Z","body":"@BauchBeinePoe hello there.\r\nVery good idea. I like it!\r\n\r\nI'm actively working on stampit v3 which is going to be [stamp-specification](https://github.com/stampit-org/stamp-specification) compatible. And your idea would perfectly fit the specification IMO.\r\n\r\nThe name should be `protected` because the object will be shared across several initializers. The \"private\" data already exist, it's the closure variables inside the initializers.\r\n\r\nThe initializer signature would be like that:\r\n```js\r\nconst Stamp = compose({\r\n  initializers: [(options, { stamp, instance, args, protected }) => {\r\n    protected.log('Some log method');\r\n  }]\r\n});\r\n```\r\n\r\nIn stampit v3 the API would be this:\r\n```js\r\nconst DbQueue = stampit.init((options, { stamp, instance, args, protected }) => {\r\n  protected.log('Some log method');\r\n});\r\n```\r\n\r\nLet's move this conversation here: https://github.com/stampit-org/stamp-specification/issues/84"}}