{"action":"created","issue":{"url":"https://api.github.com/repos/arc-repos/architect/issues/223","repository_url":"https://api.github.com/repos/arc-repos/architect","labels_url":"https://api.github.com/repos/arc-repos/architect/issues/223/labels{/name}","comments_url":"https://api.github.com/repos/arc-repos/architect/issues/223/comments","events_url":"https://api.github.com/repos/arc-repos/architect/issues/223/events","html_url":"https://github.com/arc-repos/architect/issues/223","id":387840076,"node_id":"MDU6SXNzdWUzODc4NDAwNzY=","number":223,"title":"executable .arc","user":{"login":"brianleroux","id":990,"node_id":"MDQ6VXNlcjk5MA==","avatar_url":"https://avatars3.githubusercontent.com/u/990?v=4","gravatar_id":"","url":"https://api.github.com/users/brianleroux","html_url":"https://github.com/brianleroux","followers_url":"https://api.github.com/users/brianleroux/followers","following_url":"https://api.github.com/users/brianleroux/following{/other_user}","gists_url":"https://api.github.com/users/brianleroux/gists{/gist_id}","starred_url":"https://api.github.com/users/brianleroux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianleroux/subscriptions","organizations_url":"https://api.github.com/users/brianleroux/orgs","repos_url":"https://api.github.com/users/brianleroux/repos","events_url":"https://api.github.com/users/brianleroux/events{/privacy}","received_events_url":"https://api.github.com/users/brianleroux/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-12-05T16:31:17Z","updated_at":"2018-12-06T16:51:37Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The problem: I need to create A LOT of lambdas programmatically. Like hundreds and thousands! As one could imagine the `.arc` file might get a bit unwieldy…\r\n\r\n```\r\n@app\r\ntestapp\r\n\r\n@queues\r\ncustomer001\r\ncustomer002\r\ncustomer003\r\n# ...aahh\r\ncustomer999\r\n ```\r\n\r\nI can think of three solutions. I'm not advocating for a solution here but rather thinking out loud and seeking your feedback.\r\n\r\n### Solution 1 \r\nCare not. Treat `.arc` as a static declarative file, generate the names in a script and otherwise *do nothing else* that in `.arc` file (the namespace could be common with a larger app but broken into other repos). that's an ok option but it turns the `.arc` into a write only file (which is maybe ok for this use case…). Essentailly this is 'a docs solution' as we're advocating a specific process pattern to solve rather than offering a technical solution.\r\n\r\n### Solution 2 \r\nAdd variables to `.arc`. This is a neat idea and not new. In the issue about adding tags we're discussing adding variables for tags. A variable that does sequences like the problem above is more of a function. So now we're sort of entering Velocity Templates territory here. We'd have to either invent a syntax or borrow one from somewhere familiar/portable like mustache perhaps. Either way this solution is lots of both code and docs to write.\r\n\r\n```\r\n@app\r\ntestapp\r\n\r\n@queues\r\n$seq('customer', 999) \r\n```\r\nFun bikeshed to paint tho. 🚲 \r\n\r\n### Solution 3 \r\nMake `.arc` execute an interpreter pass to mutate itself before being parsed. Sort of a combination macro and templating. The idea would be to allow JavaScript to be embedded into the template with JS template strings and we'd hit that static file with an interpreter pass before passing thru the normal parse codepath. This would allow people to embed full programs in the `.arc` file which is both dangerous and awesome. 🔥 \r\n\r\nIn this example I'm imagining that we have helpers `seq` and `zeropad` in the runtime. The real JS to do that is …something. \r\n\r\n```\r\n@app\r\ntestapp\r\n\r\n@queues\r\n${seq(999).map(zeropad).join('\\n')}\r\n```\r\n\r\nThe real JS to do the above without helper functions would be something like `${[...Array(5).keys()].map(i=> `free${i.padStart('0', 4)}` ).join('\\n')}` which is just yikes. \r\n\r\nIt def makes me pause when thinking about this solution. Bash in YAML was uncool. Not just because it was unreadable but error recovery can be time consuming and frustrating. We do not want to create situations where people can get themselves into trouble like that. \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/arc-repos/architect/issues/comments/444944099","html_url":"https://github.com/arc-repos/architect/issues/223#issuecomment-444944099","issue_url":"https://api.github.com/repos/arc-repos/architect/issues/223","id":444944099,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDk0NDA5OQ==","user":{"login":"brianleroux","id":990,"node_id":"MDQ6VXNlcjk5MA==","avatar_url":"https://avatars3.githubusercontent.com/u/990?v=4","gravatar_id":"","url":"https://api.github.com/users/brianleroux","html_url":"https://github.com/brianleroux","followers_url":"https://api.github.com/users/brianleroux/followers","following_url":"https://api.github.com/users/brianleroux/following{/other_user}","gists_url":"https://api.github.com/users/brianleroux/gists{/gist_id}","starred_url":"https://api.github.com/users/brianleroux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianleroux/subscriptions","organizations_url":"https://api.github.com/users/brianleroux/orgs","repos_url":"https://api.github.com/users/brianleroux/repos","events_url":"https://api.github.com/users/brianleroux/events{/privacy}","received_events_url":"https://api.github.com/users/brianleroux/received_events","type":"User","site_admin":false},"created_at":"2018-12-06T16:51:37Z","updated_at":"2018-12-06T16:51:37Z","author_association":"CONTRIBUTOR","body":"yeah I really like this! \r\n\r\nits a nice opt in, solves this problem case with precision and we can define a fun higher level api on top of the format pretty easily. "}}
{"actor":{"display_login":"brianleroux"}}