{"action":"created","issue":{"url":"https://api.github.com/repos/openscad/openscad/issues/1906","repository_url":"https://api.github.com/repos/openscad/openscad","labels_url":"https://api.github.com/repos/openscad/openscad/issues/1906/labels{/name}","comments_url":"https://api.github.com/repos/openscad/openscad/issues/1906/comments","events_url":"https://api.github.com/repos/openscad/openscad/issues/1906/events","html_url":"https://github.com/openscad/openscad/issues/1906","id":198624757,"number":1906,"title":"Make the object vs operator module types more explicit in the language. ","user":{"login":"zapta","id":2184769,"avatar_url":"https://avatars.githubusercontent.com/u/2184769?v=3","gravatar_id":"","url":"https://api.github.com/users/zapta","html_url":"https://github.com/zapta","followers_url":"https://api.github.com/users/zapta/followers","following_url":"https://api.github.com/users/zapta/following{/other_user}","gists_url":"https://api.github.com/users/zapta/gists{/gist_id}","starred_url":"https://api.github.com/users/zapta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zapta/subscriptions","organizations_url":"https://api.github.com/users/zapta/orgs","repos_url":"https://api.github.com/users/zapta/repos","events_url":"https://api.github.com/users/zapta/events{/privacy}","received_events_url":"https://api.github.com/users/zapta/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-01-04T03:48:33Z","updated_at":"2017-01-05T18:08:11Z","closed_at":null,"body":"Currently a module can be of two types, an object or an operator. The module type determine it's usage pattern and the kind of arguments it accepts. While this is semantically well define, it hides the conceptual difference between the two and make the concept of 'children' an hard to understand and a somewhat obscure aspect of the language. \r\n\r\nThis proposal is for making the distinction between the two more explicit in the language. It will make the code more readable (e.g. by indicating that the module is an operator that expect children) and make the concept of user defined operators more discoverable.\r\n\r\nHere is one possible syntax:\r\n\r\n> object my_object(...) {\r\n>    // references to children() at al are not allowed here. \r\n> }\r\n> \r\n> my_object(...);  // allowed.\r\n> my_object(...) { ... };   // not allowed\r\n\r\n> operator my_operator(...) {\r\n>    // references to children() at al *are* allowed here. \r\n> }\r\n> my_operator(...) {... };  // allowed\r\n> my_operator(...);          // not allowed?\r\n\r\nThe existing common 'module' syntax can stay for backward compatibility."},"comment":{"url":"https://api.github.com/repos/openscad/openscad/issues/comments/270713886","html_url":"https://github.com/openscad/openscad/issues/1906#issuecomment-270713886","issue_url":"https://api.github.com/repos/openscad/openscad/issues/1906","id":270713886,"user":{"login":"doug-moen","id":5274273,"avatar_url":"https://avatars.githubusercontent.com/u/5274273?v=3","gravatar_id":"","url":"https://api.github.com/users/doug-moen","html_url":"https://github.com/doug-moen","followers_url":"https://api.github.com/users/doug-moen/followers","following_url":"https://api.github.com/users/doug-moen/following{/other_user}","gists_url":"https://api.github.com/users/doug-moen/gists{/gist_id}","starred_url":"https://api.github.com/users/doug-moen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doug-moen/subscriptions","organizations_url":"https://api.github.com/users/doug-moen/orgs","repos_url":"https://api.github.com/users/doug-moen/repos","events_url":"https://api.github.com/users/doug-moen/events{/privacy}","received_events_url":"https://api.github.com/users/doug-moen/received_events","type":"User","site_admin":false},"created_at":"2017-01-05T18:08:11Z","updated_at":"2017-01-05T18:08:11Z","body":"I'm not currently working on OpenSCAD2. I got far enough along to figure\nout that the backward compatibility scheme described in the paper doesn't\nwork. OpenSCAD is full of weird undocumented bugs (the scoping rules are a\nparticular sore spot for me), and these bugs cannot be fixed, because we\ndon't want old scripts to break. So it is effectively impossible for an\noutside party to create an independent and fully compatible implementation\nof OpenSCAD, using modern implementation techniques, which is what I was\ntrying to do. At least, not without a lot more resources to pour into the\nproject. So my project went in a different direction. Now I've got a\nworking subset of OpenSCAD2, and I'm building a new geometry kernel from\nscratch that is focussed on different goals than OpenSCAD: curved surfaces\nare represented exactly, it's possible to model extremely complex models\nwith a lot of detail and render them quickly, and there is continuously\nvarying volumetric colour. So that's what's consuming my free time.\n\nIn order to reboot the OpenSCAD2 project, what's needed is a way to\nincrementally evolve the existing code base, adding new features from the\nOpenSCAD2 design without breaking backward compatibility. I worked out some\npreliminary ideas about this, but they need more development. Meanwhile,\nother people are welcome to cherry pick the OpenSCAD2 design and implement\nwhatever bits they like in OpenSCAD.\n\nOn 5 January 2017 at 12:01, Zapta <notifications@github.com> wrote:\n\n> >> my_translate(vector) shapes = translate(vector) shapes;\n> >>\n> >> So it achieves the same goal of indicating in the signature whether a\n> >> module accepts children as arguments.\n>\n> That's very good.\n>\n> BTW, what is the status and expected timeline of openscad2?\n>\n> (may be useful to add this information to the README/Overview files).\n>\n>\n>\n> On Thu, Jan 5, 2017 at 8:51 AM, Doug Moen <notifications@github.com>\n> wrote:\n>\n> > Zapta said\n> >\n> > > The primary goal of my proposal is to make the concept of operators\n> more\n> > > discoverable, i.e. in the cheatsheet, and more visible in the syntax.\n> >\n> > ...\n> >\n> > As it is now, the signature of your module doesn't indicate that your\n> > > module accepts children.\n> > >\n> >\n> >\n> > In the openscad2 proposal, an \"object\" is defined like this:\n> >\n> > my_cube(size) = cube(size);\n> >\n> > and an \"operator\" is defined like this:\n> >\n> > my_translate(vector) shapes = translate(vector) shapes;\n> >\n> > So it achieves the same goal of indicating in the signature whether a\n> > module accepts children as arguments.\n> >\n> >\n> >\n> >\n> > > On Wed, Jan 4, 2017 at 9:08 AM, Chris <notifications@github.com\n> > > <javascript:_e(%7B%7D,'cvml','notifications@github.com');>> wrote:\n> > >\n> > > > >As it is now, the signature of your module doesn't indicate that\n> your\n> > > > module accepts children.\n> > > >\n> > > > No but I don't see marking it as operator helps because nobody would\n> > know\n> > > > what a washer operator does without reading the code or looking from\n> a\n> > > > comment. Also it is optional, so OpenSCAD can't give a warning if it\n> > > > missing. It already gives a warning if you attempt to use child that\n> is\n> > > not\n> > > > provided. The only other error is providing a child when one is not\n> > > > expected. That could also give an error without needing a change to\n> the\n> > > > language.\n> > > >\n> > > >\n> > > > On 4 January 2017 at 16:53, Zapta <notifications@github.com\n> > > <javascript:_e(%7B%7D,'cvml','notifications@github.com');>> wrote:\n> > > >\n> > > > > >> have modules that do both. For example my washer module draws a\n> > > washer\n> > > > > but if it has a child it translates the child to be on top of it.\n> > That\n> > > > can\n> > > > > be, for example, another washer or a screw or a nut.\n> > > > >\n> > > > > You can achieve that with:\n> > > > >\n> > > > > operator my_washer() {\n> > > > > ..\n> > > > > }\n> > > > >\n> > > > > ...\n> > > > >\n> > > > > my_washer() { /* empty */ }.\n> > > > > my_washer();\n> > > > > my_washer() cube();\n> > > > > my_washer() my_other_washer();\n> > > > > my_washer() { ... };\n> > > > >\n> > > > >\n> > > > > As it is now, the signature of your module doesn't indicate that\n> your\n> > > > > module accepts children.\n> > > > >\n> > > > > On Wed, Jan 4, 2017 at 12:18 AM, Chris <notifications@github.com\n> > > <javascript:_e(%7B%7D,'cvml','notifications@github.com');>> wrote:\n> > > > >\n> > > > > > I have modules that do both. For example my washer module draws a\n> > > > washer\n> > > > > > but if it has a child it translates the child to be on top of it.\n> > > That\n> > > > > can\n> > > > > > be, for example, another washer or a screw or a nut.\n> > > > > >\n> > > > > > OpenSCAD could warn if you give a child and there are no children\n> > > > > > statements in the module.\n> > > > > >\n> > > > > > On 4 January 2017 at 07:05, Torsten Paul <\n> notifications@github.com\n> > > <javascript:_e(%7B%7D,'cvml','notifications@github.com');>>\n> > > > > wrote:\n> > > > > >\n> > > > > > > I'd suggest to discuss this a https://github.com/doug-moen/\n> > > openscad2\n> > > > .\n> > > > > > >\n> > > > > > > —\n> > > > > > > You are receiving this because you are subscribed to this\n> thread.\n> > > > > > > Reply to this email directly, view it on GitHub\n> > > > > > > <https://github.com/openscad/openscad/issues/1906#\n> > > > > issuecomment-270307174\n> > > > > > >,\n> > > > > > > or mute the thread\n> > > > > > > <https://github.com/notifications/unsubscribe-\n> > > > > auth/AAijhaOY1jGesdmzY9Fc_\n> > > > > > KFXaBuULjtqks5rO0S7gaJpZM4LaREm>\n> > > > > >\n> > > > > > > .\n> > > > > > >\n> > > > > >\n> > > > > > —\n> > > > > > You are receiving this because you authored the thread.\n> > > > > > Reply to this email directly, view it on GitHub\n> > > > > > <https://github.com/openscad/openscad/issues/1906#\n> > > > issuecomment-270316973\n> > > > > >,\n> > > > > > or mute the thread\n> > > > > > <https://github.com/notifications/unsubscribe-\n> > > > > auth/ACFWQalP3SmbmOBen6Lf8n-4LmCsvz_Vks5rO1XZgaJpZM4LaREm>\n> > > > > > .\n> > > > > >\n> > > > >\n> > > > > —\n> > > > > You are receiving this because you commented.\n> > > > > Reply to this email directly, view it on GitHub\n> > > > > <https://github.com/openscad/openscad/issues/1906#\n> > > issuecomment-270422188\n> > > > >,\n> > > > > or mute the thread\n> > > > > <https://github.com/notifications/unsubscribe-\n> > > auth/AAijhWiUr8QCvWFka99-\n> > > > 7zO7jH-IaguFks5rO86EgaJpZM4LaREm>\n> > > >\n> > > > > .\n> > > > >\n> > > >\n> > > > —\n> > > > You are receiving this because you authored the thread.\n> > > > Reply to this email directly, view it on GitHub\n> > > > <https://github.com/openscad/openscad/issues/1906#\n> > issuecomment-270426164\n> > > >,\n> > > > or mute the thread\n> > > > <https://github.com/notifications/unsubscribe-\n> auth/ACFWQXLA1lHImUAKe_\n> > > r3lW8QxPi3hOdbks5rO9IHgaJpZM4LaREm>\n> > > > .\n> > > >\n> > >\n> > > —\n> > > You are receiving this because you are subscribed to this thread.\n> > > Reply to this email directly, view it on GitHub\n> > > <https://github.com/openscad/openscad/issues/1906#\n> issuecomment-270432192\n> > >,\n> > > or mute the thread\n> > > <https://github.com/notifications/unsubscribe-auth/\n> > AFB6oZKemFjonbChK4wRxeVVaO1bRSZtks5rO9dSgaJpZM4LaREm>\n> >\n> > > .\n> > >\n> >\n> > —\n> > You are receiving this because you authored the thread.\n> > Reply to this email directly, view it on GitHub\n> > <https://github.com/openscad/openscad/issues/1906#issuecomment-270694356\n> >,\n> > or mute the thread\n> > <https://github.com/notifications/unsubscribe-auth/ACFWQSv_\n> Qo9mqZh5Hl8vlkbYxL3XMdRRks5rPR-AgaJpZM4LaREm>\n> > .\n> >\n>\n> —\n> You are receiving this because you commented.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/openscad/openscad/issues/1906#issuecomment-270697297>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AFB6oYXIzpCNYqkxW1hMniadk2r9PAkeks5rPSIHgaJpZM4LaREm>\n> .\n>\n"}}
{"actor":{"display_login":"doug-moen"}}