{"action":"created","issue":{"url":"https://api.github.com/repos/NeowayLabs/nash/issues/128","repository_url":"https://api.github.com/repos/NeowayLabs/nash","labels_url":"https://api.github.com/repos/NeowayLabs/nash/issues/128/labels{/name}","comments_url":"https://api.github.com/repos/NeowayLabs/nash/issues/128/comments","events_url":"https://api.github.com/repos/NeowayLabs/nash/issues/128/events","html_url":"https://github.com/NeowayLabs/nash/issues/128","id":186091530,"number":128,"title":"Proposals for new IFS implementation","user":{"login":"tiago4orion","id":251478,"avatar_url":"https://avatars.githubusercontent.com/u/251478?v=3","gravatar_id":"","url":"https://api.github.com/users/tiago4orion","html_url":"https://github.com/tiago4orion","followers_url":"https://api.github.com/users/tiago4orion/followers","following_url":"https://api.github.com/users/tiago4orion/following{/other_user}","gists_url":"https://api.github.com/users/tiago4orion/gists{/gist_id}","starred_url":"https://api.github.com/users/tiago4orion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiago4orion/subscriptions","organizations_url":"https://api.github.com/users/tiago4orion/orgs","repos_url":"https://api.github.com/users/tiago4orion/repos","events_url":"https://api.github.com/users/tiago4orion/events{/privacy}","received_events_url":"https://api.github.com/users/tiago4orion/received_events","type":"User","site_admin":false},"labels":[{"id":350894383,"url":"https://api.github.com/repos/NeowayLabs/nash/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":350894384,"url":"https://api.github.com/repos/NeowayLabs/nash/labels/help%20wanted","name":"help wanted","color":"128A0C","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-29T17:51:59Z","updated_at":"2016-11-12T17:22:03Z","closed_at":null,"body":"It's very annoying that your command assignment depends on a external variable be set. It's error prone and can break in unexpected ways.\n\nBecause everyone can set a default value for IFS in their init, the scripts should always be careful and set a proper value before any command assignment. \n\nThere are two ways I can think of to solve this problem. Remove IFS entirely or make it scoped.\n## No IFS (No split by default)\n\n_backward incompatible_\n\nThis way, every command assignment will always return a string and we'll need a built in function to split it explicitly into a list:\n\n``` sh\nval <= cat data.csv | grep -v \"header\" # $val store entire string\nval <= split($val, (\"\\n\")) # Split data into a list and store in $val\n```\n## Scoped IFS\n\n_backward compatible_ \n\nUsing IIFE (immediately-invoked function expression):\n\n``` sh\nval <= fn () {\n        IFS = (\"\\n\")\n        ret <= cat data.csv | grep -v \"header\"\n        return $ret\n}()\n```\n\nIt`s not supported yet, but easy to implement and works, but as this kind of assignment occurs very often, we need a shorter way...\n\nMaybe a built in `split` command in the pipe:\n\n``` sh\nval <= cat data.csv | grep -v \"header\" | split \"\\n\"\n```\n\nBut it must be the last component of the pipeline...\n\nMaybe improve the syntax to support scoped variables in statements:\n\n``` sh\nval <= (echo $path) path = $PATH\nval <= (cat data.csv | grep -v \"header\") IFS = (\"\\n\")\n```\n\nI cannot think of a better way to improve the syntax to support scoped variables...  Maybe someone could help.\n\n@katcipis @lborguetti \nIdeas?\n"},"comment":{"url":"https://api.github.com/repos/NeowayLabs/nash/issues/comments/260135221","html_url":"https://github.com/NeowayLabs/nash/issues/128#issuecomment-260135221","issue_url":"https://api.github.com/repos/NeowayLabs/nash/issues/128","id":260135221,"user":{"login":"katcipis","id":157634,"avatar_url":"https://avatars.githubusercontent.com/u/157634?v=3","gravatar_id":"","url":"https://api.github.com/users/katcipis","html_url":"https://github.com/katcipis","followers_url":"https://api.github.com/users/katcipis/followers","following_url":"https://api.github.com/users/katcipis/following{/other_user}","gists_url":"https://api.github.com/users/katcipis/gists{/gist_id}","starred_url":"https://api.github.com/users/katcipis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katcipis/subscriptions","organizations_url":"https://api.github.com/users/katcipis/orgs","repos_url":"https://api.github.com/users/katcipis/repos","events_url":"https://api.github.com/users/katcipis/events{/privacy}","received_events_url":"https://api.github.com/users/katcipis/received_events","type":"User","site_admin":false},"created_at":"2016-11-12T17:22:03Z","updated_at":"2016-11-12T17:22:03Z","body":"I like the no IFS idea...still cant see one single advantage of it besides being hard to understand and implicit"}}
{"actor":{"display_login":"katcipis"}}