Title: Define Syntax for Iterator Definition · Issue #154 · ZenCodeLang/ZenCode · GitHub
Open Graph Title: Define Syntax for Iterator Definition · Issue #154 · ZenCodeLang/ZenCode
X Title: Define Syntax for Iterator Definition · Issue #154 · ZenCodeLang/ZenCode
Description: Currently, StdLib's Iterable.zs defines the Iterator-Member like so: for(item as T) as Iterator
Open Graph Description: Currently, StdLib's Iterable.zs defines the Iterator-Member like so: for(item as T) as Iterator
X Description: Currently, StdLib's Iterable.zs defines the Iterator-Member like so: for(item as T) as Iterator<T> => iterate(); However, the parser expects: for(T) { // What to do in here? } Defined ...
Opengraph URL: https://github.com/ZenCodeLang/ZenCode/issues/154
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Define Syntax for Iterator Definition","articleBody":"Currently, StdLib's [Iterable.zs](https://github.com/ZenCodeLang/StdLibs/blob/master/src/main/zencode/stdlib/src/Iterable.zs) defines the Iterator-Member like so:\n\n```zs\nfor(item as T) as Iterator\u003cT\u003e =\u003e iterate();\n```\n\nHowever, the parser expects:\n```zs\nfor(T) {\n // What to do in here?\n}\n```\n\nDefined in ParsedDefinitionMember:\n```java\n\t\t\tcase K_FOR: {\n\t\t\t\ttokens.next();\n\n\t\t\t\ttokens.required(T_BROPEN, \"( expected\");\n\n\t\t\t\tList\u003cIParsedType\u003e loopVariableTypes = new ArrayList\u003c\u003e();\n\t\t\t\tif (tokens.optional(T_BRCLOSE) == null) {\n\t\t\t\t\tdo {\n\t\t\t\t\t\tloopVariableTypes.add(IParsedType.parse(tokens));\n\t\t\t\t\t} while (tokens.optional(T_COMMA) != null);\n\t\t\t\t\ttokens.required(T_BRCLOSE, \") expected\");\n\t\t\t\t}\n\n\t\t\t\tParsedFunctionBody body = ParsedStatement.parseFunctionBody(tokens);\n\t\t\t\treturn new ParsedIterator(start, modifiers, annotations, loopVariableTypes, body);\n\t\t\t}\n```\n\nWe need to define how the iterator members should look like and how it should behave.\n\nAcceptance Criteria:\n- [ ] The syntax is defined\n- [ ] The header in stdlibs is adapted to whatever syntax we adopt\n- [ ] There exist tests that cover the basic iterator functionality\n - [ ] Defining an iterator\n - [ ] Calling it\n - [ ] Overloading iterators with multiple variables\n - [ ] Doing that on a generic data type like List\u003cT\u003e","author":{"url":"https://github.com/kindlich","@type":"Person","name":"kindlich"},"datePublished":"2024-06-08T18:03:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/154/ZenCode/issues/154"}
| 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:2403450c-7d6e-fb75-169e-2692ffc41d75 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE94:5FBC2:12B3798:1791BC0:6991706E |
| html-safe-nonce | eea88a34478d12190ed365768696cac46a324d5f3c13b0378307324001ee73f2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTk0OjVGQkMyOjEyQjM3OTg6MTc5MUJDMDo2OTkxNzA2RSIsInZpc2l0b3JfaWQiOiIyMTU4MTY5ODk3NzcwNzc0NjM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fcd901a6da303cbd9f8ac950e6de3c79574af359ac55c9035b5e1c530eb50421 |
| hovercard-subject-tag | issue:2341765384 |
| 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/ZenCodeLang/ZenCode/154/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eaff989772850648612220f08993f2c3a87af845f80376169ce7c5d2d2168c98/ZenCodeLang/ZenCode/issues/154 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eaff989772850648612220f08993f2c3a87af845f80376169ce7c5d2d2168c98/ZenCodeLang/ZenCode/issues/154 |
| og:image:alt | Currently, StdLib's Iterable.zs defines the Iterator-Member like so: for(item as T) as Iterator |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kindlich |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/ZenCodeLang/ZenCode git https://github.com/ZenCodeLang/ZenCode.git |
| octolytics-dimension-user_id | 68248418 |
| octolytics-dimension-user_login | ZenCodeLang |
| octolytics-dimension-repository_id | 309683985 |
| octolytics-dimension-repository_nwo | ZenCodeLang/ZenCode |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 309683985 |
| octolytics-dimension-repository_network_root_nwo | ZenCodeLang/ZenCode |
| 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 | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width