{"action":"created","issue":{"url":"https://api.github.com/repos/phetsims/axon/issues/182","repository_url":"https://api.github.com/repos/phetsims/axon","labels_url":"https://api.github.com/repos/phetsims/axon/issues/182/labels{/name}","comments_url":"https://api.github.com/repos/phetsims/axon/issues/182/comments","events_url":"https://api.github.com/repos/phetsims/axon/issues/182/events","html_url":"https://github.com/phetsims/axon/issues/182","id":357394462,"node_id":"MDU6SXNzdWUzNTczOTQ0NjI=","number":182,"title":"Should each Emitter instance be allowed to emit with any number of args?","user":{"login":"zepumph","id":6856943,"node_id":"MDQ6VXNlcjY4NTY5NDM=","avatar_url":"https://avatars1.githubusercontent.com/u/6856943?v=4","gravatar_id":"","url":"https://api.github.com/users/zepumph","html_url":"https://github.com/zepumph","followers_url":"https://api.github.com/users/zepumph/followers","following_url":"https://api.github.com/users/zepumph/following{/other_user}","gists_url":"https://api.github.com/users/zepumph/gists{/gist_id}","starred_url":"https://api.github.com/users/zepumph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zepumph/subscriptions","organizations_url":"https://api.github.com/users/zepumph/orgs","repos_url":"https://api.github.com/users/zepumph/repos","events_url":"https://api.github.com/users/zepumph/events{/privacy}","received_events_url":"https://api.github.com/users/zepumph/received_events","type":"User","site_admin":false},"labels":[{"id":322182440,"node_id":"MDU6TGFiZWwzMjIxODI0NDA=","url":"https://api.github.com/repos/phetsims/axon/labels/priority:3-medium","name":"priority:3-medium","color":"FFE600","default":false},{"id":325282744,"node_id":"MDU6TGFiZWwzMjUyODI3NDQ=","url":"https://api.github.com/repos/phetsims/axon/labels/status:on-hold","name":"status:on-hold","color":"F0FFF0","default":false},{"id":322182475,"node_id":"MDU6TGFiZWwzMjIxODI0NzU=","url":"https://api.github.com/repos/phetsims/axon/labels/type:misc","name":"type:misc","color":"B87333","default":false},{"id":42421371,"node_id":"MDU6TGFiZWw0MjQyMTM3MQ==","url":"https://api.github.com/repos/phetsims/axon/labels/type:question","name":"type:question","color":"EDCB62","default":false}],"state":"open","locked":false,"assignee":{"login":"zepumph","id":6856943,"node_id":"MDQ6VXNlcjY4NTY5NDM=","avatar_url":"https://avatars1.githubusercontent.com/u/6856943?v=4","gravatar_id":"","url":"https://api.github.com/users/zepumph","html_url":"https://github.com/zepumph","followers_url":"https://api.github.com/users/zepumph/followers","following_url":"https://api.github.com/users/zepumph/following{/other_user}","gists_url":"https://api.github.com/users/zepumph/gists{/gist_id}","starred_url":"https://api.github.com/users/zepumph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zepumph/subscriptions","organizations_url":"https://api.github.com/users/zepumph/orgs","repos_url":"https://api.github.com/users/zepumph/repos","events_url":"https://api.github.com/users/zepumph/events{/privacy}","received_events_url":"https://api.github.com/users/zepumph/received_events","type":"User","site_admin":false},"assignees":[{"login":"zepumph","id":6856943,"node_id":"MDQ6VXNlcjY4NTY5NDM=","avatar_url":"https://avatars1.githubusercontent.com/u/6856943?v=4","gravatar_id":"","url":"https://api.github.com/users/zepumph","html_url":"https://github.com/zepumph","followers_url":"https://api.github.com/users/zepumph/followers","following_url":"https://api.github.com/users/zepumph/following{/other_user}","gists_url":"https://api.github.com/users/zepumph/gists{/gist_id}","starred_url":"https://api.github.com/users/zepumph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zepumph/subscriptions","organizations_url":"https://api.github.com/users/zepumph/orgs","repos_url":"https://api.github.com/users/zepumph/repos","events_url":"https://api.github.com/users/zepumph/events{/privacy}","received_events_url":"https://api.github.com/users/zepumph/received_events","type":"User","site_admin":false}],"milestone":null,"comments":33,"created_at":"2018-09-05T20:41:37Z","updated_at":"2019-01-05T01:03:23Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Right now there is complete flexibility on how many arguments you emit with for an emitter instance. So far there haven't seen to be any complaints about this loose system, but @samreid, @chrisklus, and @zepumph ran into difficulties with this for PhET-iO today. \r\n\r\nWould this be safer and more maintainable if an Emitter instance was defined with a set number of args that it expected to emit with? Perhaps this would be too rigid of a system? Are there many places where a single emitter will use more than one emitting function in different use cases?\r\n\r\nFor example, here is something you can currently do with Emitter:\r\n\r\n```js\r\n\r\nvar e = new Emitter();\r\n\r\ne.emit();\r\n\r\ne.emit1( new Property());\r\n\r\ne.emit3( 'hi', 'you', 'rock')\r\n\r\ne.emit1( new Vector2( 3, 4) );\r\n```\r\n\r\nFor obvious reasons, this seems brittle and difficult when it comes to adding listeners to this `Emitter`.\r\n\r\nThe reason this came up, was because we were trying to decide how `EmitterIO` should properly serialize Emitter's arg types. For example we have an `EmitterIO.<BooleanIO>` that is still technically allowed to `emit3()`, although that breaks across the phet-io api. \r\n\r\nA \"strong typing\" solution (that we aren't necessarily pushing for) would be to have a different type for each number of args you plan to emit for, like `Emitter extends BaseEmitter`, `Emitter1 extends BaseEmitter`, `Emitter2 extends BaseEmitter`. Each type would only have the emitting method that corresponds to the number of args it is made for."},"comment":{"url":"https://api.github.com/repos/phetsims/axon/issues/comments/451613063","html_url":"https://github.com/phetsims/axon/issues/182#issuecomment-451613063","issue_url":"https://api.github.com/repos/phetsims/axon/issues/182","id":451613063,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTYxMzA2Mw==","user":{"login":"zepumph","id":6856943,"node_id":"MDQ6VXNlcjY4NTY5NDM=","avatar_url":"https://avatars1.githubusercontent.com/u/6856943?v=4","gravatar_id":"","url":"https://api.github.com/users/zepumph","html_url":"https://github.com/zepumph","followers_url":"https://api.github.com/users/zepumph/followers","following_url":"https://api.github.com/users/zepumph/following{/other_user}","gists_url":"https://api.github.com/users/zepumph/gists{/gist_id}","starred_url":"https://api.github.com/users/zepumph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zepumph/subscriptions","organizations_url":"https://api.github.com/users/zepumph/orgs","repos_url":"https://api.github.com/users/zepumph/repos","events_url":"https://api.github.com/users/zepumph/events{/privacy}","received_events_url":"https://api.github.com/users/zepumph/received_events","type":"User","site_admin":false},"created_at":"2019-01-05T01:03:23Z","updated_at":"2019-01-05T01:03:23Z","author_association":"CONTRIBUTOR","body":"In https://github.com/phetsims/axon/issues/189 we have come up with a nice strategy for Property, and now need to apply this to Emitter. Afterwards we will will add phetioType to Validator.js in https://github.com/phetsims/axon/issues/194.\r\n\r\nMarking off hold to try to convert usages currently using `TypeDef` and `Emitter.argumentTypes` over to use `Validator`."}}
{"actor":{"display_login":"zepumph"}}