Greetings Chapel Users:
In Chapel, definitions for operators can be provided only as non-methods, e.g.
proc =(a, b) { ... }
The main question is whether it would also be useful to be able to define
operators as methods, e.g.
class C{}
proc C.=(b) { ... }
This makes more sense for "op=" operators, including assignment itself ("=") as
well as "+=", "-=", etc. since their default semantics update the left operand.
However, since the semantics of the user-defined version is up to the class
designer, it might make sense to support both forms, even for operators whose
default semantics are symmetrical.
If operators can be defined as methods, then invoking "a + b" would be
translated as either "=(a,b)" or "a.=(b)", depending on which version of the
operator was defined. (If both are defined, it would result in an ambiguity
during resolution.)
A subordinate question is whether the calls explicitly coded as "=(a,b)" or
"a.=(b)" should bind only to a definition with the matching signature
(non-method vs. method), or whether each could bind to the other. We can term
the first rule "strict binding" and the second "loose binding". In that case,
strict binding means
=(a,b) binds only to proc =(a,b)
a.=(b) binds only to proc C.=(b)
whereas loose binding means
=(a,b) binds to either proc =(a,b) or proc C.=(b)
a.=(b) binds to either proc =(a,b) or proc C.=(b)
.
Please send your opinions as to whether we should support:
a) Only the current non-method syntax for operator definitions;
b) Both non-method and method syntax for all operators;
c) Non-method syntax for symmetrical operators and method syntax for "op="
operators (including assignment); or
d) Other.
If you favor supporting a combination of non-method and method definitions
(whether exclusive or not), please indicate whether you favor strict or loose
binding.
Thanks,
Tom Hildebrandt
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users