Title: ast: Call cannot distinguish foo from foo() (VCALL vs FCALL) · Issue #41 · go-ruby-parser/parser · GitHub
Open Graph Title: ast: Call cannot distinguish foo from foo() (VCALL vs FCALL) · Issue #41 · go-ruby-parser/parser
X Title: ast: Call cannot distinguish foo from foo() (VCALL vs FCALL) · Issue #41 · go-ruby-parser/parser
Description: foo and foo() produce the same ast.Call, so nothing downstream can tell a VCALL from an FCALL Sibling of #40, same shape of gap on a different node. // ast/ast.go type Call struct { Recv Node Name string Args []Node Block *Block Safe boo...
Open Graph Description: foo and foo() produce the same ast.Call, so nothing downstream can tell a VCALL from an FCALL Sibling of #40, same shape of gap on a different node. // ast/ast.go type Call struct { Recv Node Name ...
X Description: foo and foo() produce the same ast.Call, so nothing downstream can tell a VCALL from an FCALL Sibling of #40, same shape of gap on a different node. // ast/ast.go type Call struct { Recv Node Name ...
Opengraph URL: https://github.com/go-ruby-parser/parser/issues/41
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ast: Call cannot distinguish foo from foo() (VCALL vs FCALL)","articleBody":"## `foo` and `foo()` produce the same `ast.Call`, so nothing downstream can tell a VCALL from an FCALL\n\nSibling of #40, same shape of gap on a different node.\n\n```go\n// ast/ast.go\ntype Call struct {\n\tRecv Node\n\tName string\n\tArgs []Node\n\tBlock *Block\n\tSafe bool // &. safe navigation\n}\n```\n\nNothing records whether the call site was written with parentheses, and `Call` carries no position from which a consumer could re-read the source.\n\n### Why Ruby needs the difference\n\nMRI distinguishes a **VCALL** — a bare name that could have been a local variable — from an **FCALL**, an explicit call. It changes both the exception class and the message:\n\n```ruby\nnope_xyz # NameError: undefined local variable or method 'nope_xyz' for main\nnope_xyz() # NoMethodError: undefined method 'nope_xyz' for main\n```\n\n`go-embedded-ruby/ruby` currently raises `NoMethodError` for both, and cannot do otherwise: the VM receives two identical nodes. A `FlagSendVCall` bit was added there and the compiler sets it, but the compiler has nothing to set it *from* for the parenthesised case, so `foo` and `foo()` still cannot diverge.\n\n### Cost, measured\n\nOne example: `language/send_spec.rb:235`, *\"if invoked as an unambiguous method call\"*. Small — but the consumer is otherwise complete on this path, and the residual is entirely here.\n\n### Suggested shape\n\n```go\ntype Call struct {\n\tRecv Node\n\tName string\n\tArgs []Node\n\tBlock *Block\n\tSafe bool\n\tParen bool // written with parentheses: an FCALL, not a VCALL\n}\n```\n\nSame precedent as #40 — `RangeLit.Exclusive` already records one bit of written form on a literal node, because the two spellings mean different things. A new field with a false zero value keeps every existing consumer compiling and behaving as it does today; only a consumer that reads it changes.\n\nThe grammar already separates them: `method_call` for the parenthesised form and `operation` / `var_ref` for the bare one (`parse.y-ruby_4_0`), so the information exists at the point the node is built and is discarded there.\n\nHappy to send the PR here and on the consumer side, if the shape is agreeable — the same offer as #40, and the two would land well together.\n","author":{"url":"https://github.com/tannevaled","@type":"Person","name":"tannevaled"},"datePublished":"2026-09-28T14:44:36Z","url":"https://github.com/go-ruby-parser/parser/issues/41"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5b06f83f-41a2-626a-7ea7-b463d9da1bdf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EAF6:1AC597:3EE7028:53CFD61:6B03FF8B |
| html-safe-nonce | 8ced83b916f4d1660c19872d644dd1a7dfd93ebfd899c570793d060374c2248a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUY2OjFBQzU5NzozRUU3MDI4OjUzQ0ZENjE6NkIwM0ZGOEIiLCJ2aXNpdG9yX2lkIjoiMjIzNDkxNjM4OTIzNDQwOTM1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 075cb729ae4209a83ff45357f3a63d290ab27d80a25847945e07b23bb65013ab |
| hovercard-subject-tag | issue:5616447137 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/go-ruby-parser/parser/41/issue_layout |
| twitter:image | https://opengraph.githubassets.com/df245cd022619d611441644f3c3963685b844bb0e27238a58b6599ed03b91a35/go-ruby-parser/parser/issues/41 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/df245cd022619d611441644f3c3963685b844bb0e27238a58b6599ed03b91a35/go-ruby-parser/parser/issues/41 |
| og:image:alt | foo and foo() produce the same ast.Call, so nothing downstream can tell a VCALL from an FCALL Sibling of #40, same shape of gap on a different node. // ast/ast.go type Call struct { Recv Node Name ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tannevaled |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/go-ruby-parser/parser git https://github.com/go-ruby-parser/parser.git |
| octolytics-dimension-user_id | 295635196 |
| octolytics-dimension-user_login | go-ruby-parser |
| octolytics-dimension-repository_id | 1276240137 |
| octolytics-dimension-repository_nwo | go-ruby-parser/parser |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1276240137 |
| octolytics-dimension-repository_network_root_nwo | go-ruby-parser/parser |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width