{"action":"created","issue":{"url":"https://api.github.com/repos/voidqk/sink/issues/54","repository_url":"https://api.github.com/repos/voidqk/sink","labels_url":"https://api.github.com/repos/voidqk/sink/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/voidqk/sink/issues/54/comments","events_url":"https://api.github.com/repos/voidqk/sink/issues/54/events","html_url":"https://github.com/voidqk/sink/issues/54","id":382596681,"node_id":"MDU6SXNzdWUzODI1OTY2ODE=","number":54,"title":"Callbacks","user":{"login":"steve64","id":11876402,"node_id":"MDQ6VXNlcjExODc2NDAy","avatar_url":"https://avatars2.githubusercontent.com/u/11876402?v=4","gravatar_id":"","url":"https://api.github.com/users/steve64","html_url":"https://github.com/steve64","followers_url":"https://api.github.com/users/steve64/followers","following_url":"https://api.github.com/users/steve64/following{/other_user}","gists_url":"https://api.github.com/users/steve64/gists{/gist_id}","starred_url":"https://api.github.com/users/steve64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve64/subscriptions","organizations_url":"https://api.github.com/users/steve64/orgs","repos_url":"https://api.github.com/users/steve64/repos","events_url":"https://api.github.com/users/steve64/events{/privacy}","received_events_url":"https://api.github.com/users/steve64/received_events","type":"User","site_admin":false},"labels":[{"id":382957682,"node_id":"MDU6TGFiZWwzODI5NTc2ODI=","url":"https://api.github.com/repos/voidqk/sink/labels/wontfix","name":"wontfix","color":"ffffff","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-20T10:29:17Z","updated_at":"2018-11-21T08:02:19Z","closed_at":"2018-11-20T22:09:17Z","author_association":"NONE","body":"Is there any way for the host to invoke a script command (function) by name or pointer or whatever ?\r\nThis would be important, for instance, to implement callbacks written in Sink with the host implementing GUI stuff. Event-driven Sink programs, more generally, would be enabled by this."},"comment":{"url":"https://api.github.com/repos/voidqk/sink/issues/comments/440571657","html_url":"https://github.com/voidqk/sink/issues/54#issuecomment-440571657","issue_url":"https://api.github.com/repos/voidqk/sink/issues/54","id":440571657,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDU3MTY1Nw==","user":{"login":"steve64","id":11876402,"node_id":"MDQ6VXNlcjExODc2NDAy","avatar_url":"https://avatars2.githubusercontent.com/u/11876402?v=4","gravatar_id":"","url":"https://api.github.com/users/steve64","html_url":"https://github.com/steve64","followers_url":"https://api.github.com/users/steve64/followers","following_url":"https://api.github.com/users/steve64/following{/other_user}","gists_url":"https://api.github.com/users/steve64/gists{/gist_id}","starred_url":"https://api.github.com/users/steve64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve64/subscriptions","organizations_url":"https://api.github.com/users/steve64/orgs","repos_url":"https://api.github.com/users/steve64/repos","events_url":"https://api.github.com/users/steve64/events{/privacy}","received_events_url":"https://api.github.com/users/steve64/received_events","type":"User","site_admin":false},"created_at":"2018-11-21T08:02:19Z","updated_at":"2018-11-21T08:02:19Z","author_association":"NONE","body":"Ok, understood. I will try to exploit an event loop.\nThanks for quick feedback.\n\n________________________________\nDa: Sean <notifications@github.com>\nInviato: martedì 20 novembre 2018 23:09\nA: voidqk/sink\nCc: steve64; Author\nOggetto: Re: [voidqk/sink] Callbacks (#54)\n\n\nNo, I experimented with a couple different ways to do this, and I settled on doing an old school event loop, for simplicity. The sink code just dispatches the events itself, in a do-while loop.\n\nThis means implementing a native function like events.getnext, which will get the next event, or wait until an event is added. Then the sink code would be something like:\n\ndo\n  var { type, args } = events.getnext\nwhile type != events.QUIT\n  # handle event\n  if type == events.MOUSEMOVE\n    onMouseMove args\n  elseif type == events.MOUSECLICK\n    onMouseClick args\n  # etc...\n  end\nend\n# quit happened...\n\n\nHere's an issue where I discuss options, but eventually concluded not to do anything: #51<https://github.com/voidqk/sink/issues/51>\n\nAnd another idea for event based processing here: #28<https://github.com/voidqk/sink/issues/28>\n\n—\nYou are receiving this because you authored the thread.\nReply to this email directly, view it on GitHub<https://github.com/voidqk/sink/issues/54#issuecomment-440447131>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ALU4MuVKK8p7KbcpOHzoEMXMXEcWIvswks5uxH2OgaJpZM4Yqzno>.\n"}}
{"actor":{"display_login":"steve64"}}