{"action":"created","issue":{"url":"https://api.github.com/repos/derekparker/delve/issues/285","labels_url":"https://api.github.com/repos/derekparker/delve/issues/285/labels{/name}","comments_url":"https://api.github.com/repos/derekparker/delve/issues/285/comments","events_url":"https://api.github.com/repos/derekparker/delve/issues/285/events","html_url":"https://github.com/derekparker/delve/pull/285","id":114254358,"number":285,"title":"proc: Implements expression interpreter","user":{"login":"aarzilli","id":303620,"avatar_url":"https://avatars.githubusercontent.com/u/303620?v=3","gravatar_id":"","url":"https://api.github.com/users/aarzilli","html_url":"https://github.com/aarzilli","followers_url":"https://api.github.com/users/aarzilli/followers","following_url":"https://api.github.com/users/aarzilli/following{/other_user}","gists_url":"https://api.github.com/users/aarzilli/gists{/gist_id}","starred_url":"https://api.github.com/users/aarzilli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aarzilli/subscriptions","organizations_url":"https://api.github.com/users/aarzilli/orgs","repos_url":"https://api.github.com/users/aarzilli/repos","events_url":"https://api.github.com/users/aarzilli/events{/privacy}","received_events_url":"https://api.github.com/users/aarzilli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-30T11:43:26Z","updated_at":"2015-10-30T18:28:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/derekparker/delve/pulls/285","html_url":"https://github.com/derekparker/delve/pull/285","diff_url":"https://github.com/derekparker/delve/pull/285.diff","patch_url":"https://github.com/derekparker/delve/pull/285.patch"},"body":"Supported operators:\r\n\r\n- All (binary and unary) operators between basic types except <-, ++ and -- (includes & to take the address of an expression)\r\n- Comparison operators between supported compound types\r\n- Typecast of integer constants into pointer types\r\n- struct members\r\n- indexing of arrays, slices and strings\r\n- slicing of arrays, slices and strings\r\n- pointer dereferencing\r\n- true, false and nil constants\r\n\r\nImplements #116, #117 and #251 \r\n\r\nThe big missing things are:\r\n- function calls\r\n- support for some kinds (maps, interfaces, chans)\r\n- support for some builtins that do not require function calls (like `len` for example)\r\n- support for type casts between simple types\r\n\r\nThe weirdest thing here is that constants in go are untyped so evaluating a constant results in a variable with `Type == \"\"`. However for constant strings and constant booleans we could create a fake type."},"comment":{"url":"https://api.github.com/repos/derekparker/delve/issues/comments/152609694","html_url":"https://github.com/derekparker/delve/pull/285#issuecomment-152609694","issue_url":"https://api.github.com/repos/derekparker/delve/issues/285","id":152609694,"user":{"login":"aarzilli","id":303620,"avatar_url":"https://avatars.githubusercontent.com/u/303620?v=3","gravatar_id":"","url":"https://api.github.com/users/aarzilli","html_url":"https://github.com/aarzilli","followers_url":"https://api.github.com/users/aarzilli/followers","following_url":"https://api.github.com/users/aarzilli/following{/other_user}","gists_url":"https://api.github.com/users/aarzilli/gists{/gist_id}","starred_url":"https://api.github.com/users/aarzilli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aarzilli/subscriptions","organizations_url":"https://api.github.com/users/aarzilli/orgs","repos_url":"https://api.github.com/users/aarzilli/repos","events_url":"https://api.github.com/users/aarzilli/events{/privacy}","received_events_url":"https://api.github.com/users/aarzilli/received_events","type":"User","site_admin":false},"created_at":"2015-10-30T18:28:13Z","updated_at":"2015-10-30T18:28:13Z","body":"As you have noticed, it already is \"kind of\" attached to print, because I rerouted EvalVariable to use it (perhaps it should be renamed before the API is frozen?)\r\n\r\n`set` also uses this through `SetVariable` and has a worse problem than `print` with interpreting its argument because we can't just split on the first space anymore. If we change the syntax of `set` to be:\r\n\r\n```\r\n     set <expression> = <expression>\r\n```\r\n\r\nwe can use `go/ast` (in a rather hacky way) to find out the correct split point.\r\n\r\nWhen map support will be added there will be an additional problem with terminal:\r\n\r\n```\r\nprint someMap[\"a  string\"]\r\n```\r\n\r\nwon't work because the two spaces in the strings will get collapsed.\r\n\r\nBeyond `print` and `set` I was thinking of hooking up linespecs to this so that when we have code like this:\r\n\r\n```\r\nvar amap map[string]func(int) = ...\r\n```\r\n\r\nwe can set breakpoints like this:\r\n\r\n```\r\nbreak *amap[\"some string\"]\r\n```\r\n\r\nFinally this could be used to implement conditional breakpoints. That's what I have in mind."}}