Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alternative ways to indicate method not provided #15271

Open
mppf opened this issue Mar 19, 2020 · 0 comments
Open

alternative ways to indicate method not provided #15271

mppf opened this issue Mar 19, 2020 · 0 comments

Comments

@mppf
Copy link
Member

mppf commented Mar 19, 2020

Spin-off from #8065.

There are currently a few stylized ways to indicate a type is not copyable or assignable (using where false on the init= or a compilerError in the init=). However we might prefer to have alternative ways to do this. This issue discusses other alternatives.

new syntax

e.g. proc init=(other) = none (or something)

Pros:

  • new syntax can give us a general structure to provide pure virtual methods (should Chapel allow pure virtual methods? #8566) and opt-in to compiler-generated default initializer or init=
  • while the new syntax might not come up often for users, it will be reasonably clear to read and won't contain things like superfluous method bodies

Cons:

  • it requires new syntax
  • perhaps pure virtual methods and opt-in to compiler-generated default initializer are different enough problems that they should have different solutions

attributes

use attributes on the type, with a generalized attribute syntax (see #14141), to indicate it; e.g. @attribute(no copy init) record R { }

Pros:

  • attribute can be reasonably clear to read and apply to type
  • able to also indicate things like opting in to default initializer or init=

Cons:

  • what functions compiler generates might be too fundamental for attributes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant