{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/proposal-pipeline-operator/issues/154","repository_url":"https://api.github.com/repos/tc39/proposal-pipeline-operator","labels_url":"https://api.github.com/repos/tc39/proposal-pipeline-operator/issues/154/labels{/name}","comments_url":"https://api.github.com/repos/tc39/proposal-pipeline-operator/issues/154/comments","events_url":"https://api.github.com/repos/tc39/proposal-pipeline-operator/issues/154/events","html_url":"https://github.com/tc39/proposal-pipeline-operator/issues/154","id":464739327,"node_id":"MDU6SXNzdWU0NjQ3MzkzMjc=","number":154,"title":"Operator vs pipe method","user":{"login":"dfernandez79","id":1102266,"node_id":"MDQ6VXNlcjExMDIyNjY=","avatar_url":"https://avatars0.githubusercontent.com/u/1102266?v=4","gravatar_id":"","url":"https://api.github.com/users/dfernandez79","html_url":"https://github.com/dfernandez79","followers_url":"https://api.github.com/users/dfernandez79/followers","following_url":"https://api.github.com/users/dfernandez79/following{/other_user}","gists_url":"https://api.github.com/users/dfernandez79/gists{/gist_id}","starred_url":"https://api.github.com/users/dfernandez79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfernandez79/subscriptions","organizations_url":"https://api.github.com/users/dfernandez79/orgs","repos_url":"https://api.github.com/users/dfernandez79/repos","events_url":"https://api.github.com/users/dfernandez79/events{/privacy}","received_events_url":"https://api.github.com/users/dfernandez79/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-07-05T18:33:10Z","updated_at":"2019-07-08T15:00:48Z","closed_at":null,"author_association":"NONE","body":"I don't know if the GitHub issues are the right place to send comments about the proposal to outsiders. Sorry if my comment is in the wrong place.\r\n\r\nRight now I'm working in a DSL like code, and having this infix compose operator will be wonderful. However, while reading the proposal I wonder if adding a  `pipe` function (like RxJS, also mentioned in the README) to built-in objects was considered.\r\n```\r\nlet result = \"hello\"\r\n  |> doubleSay\r\n  |> capitalize\r\n  |> exclaim;\r\n```\r\n```\r\nlet result = \"hello\".pipe(\r\n  doubleSay,\r\n  capitalize,\r\n  exclaim\r\n);\r\n```\r\n\r\n**Advantages:**\r\n- *Compatibility:* Doesn't require parser changes, so current tooling will work.\r\nIt works with numbers too if you add parenthesis (today Number has some instance methods too).\r\n- *Extensibility:* Objects may be able to override the default behavior (Object.prototype already includes methods like toString, hasOwnProperty)\r\n\r\n**Disadvantage:**\r\n- May cause issues with objects that already define a pipe method.\r\n\r\nI'm not proposing a change, but if there are any pointers to related discussions it will be helpful to learn more (I saw discussions about a pipe function but not about a pipe method). \r\n\r\nMany thanks\r\n\r\n**Related Discussions:**\r\nThere seem to be related discussions:\r\n- https://github.com/tc39/proposal-pipeline-operator/issues/131\r\n- https://github.com/tc39/proposal-pipeline-operator/issues/146\r\n\r\nSome of the comments mention that the global built-in pipe function is not as easy to read as the operator. However, \"hard\" or \"easy\" to read sometimes depends on how used you are with the syntax. For example: is hard for me to favor this style `fn(a |> b |> c, x |> y |> z)` over this `fn(a.pipe(b,c),x.pipe(y,z));`. \r\n\r\nMy observations are about compatibility and extensibility; usability will be better answer by studies like the one of https://github.com/tc39/proposal-pipeline-operator/issues/150"},"comment":{"url":"https://api.github.com/repos/tc39/proposal-pipeline-operator/issues/comments/509262338","html_url":"https://github.com/tc39/proposal-pipeline-operator/issues/154#issuecomment-509262338","issue_url":"https://api.github.com/repos/tc39/proposal-pipeline-operator/issues/154","id":509262338,"node_id":"MDEyOklzc3VlQ29tbWVudDUwOTI2MjMzOA==","user":{"login":"ljharb","id":45469,"node_id":"MDQ6VXNlcjQ1NDY5","avatar_url":"https://avatars1.githubusercontent.com/u/45469?v=4","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"created_at":"2019-07-08T15:00:48Z","updated_at":"2019-07-08T15:00:48Z","author_association":"MEMBER","body":"Yes, but this would be to Function.prototype."}}
{"actor":{"display_login":"ljharb"}}