Comments (2)
Historically, we shied away from supporting these operators in Chapel's original design because we were generally trying to avoid supporting operators that modified things at the expression level (primarily to reduce the number of cases in which we'd need to understand read vs. write semantics on expressions in the compiler). I.e., the only way to modify things was through assignment operators and function calls. (We also avoided expression-level assignment for this reason, though the rationale for that decision is arguably stronger, since it helps avoid common =
vs. ==
mistakes and could result in confusion in contexts like named argument passing). I also was never particularly fond of (or good at) distinguishing between ++a
and a++
.
All that said, my personal negativity toward them isn't as strong today as it was then. In the past I've argued "you can always define methods that do this so there's no need for language support" and while that's true, it also suggests that supporting them wouldn't be all that bad / different from doing so via methods, while being succinct and familiar to C-family programmers. All that said, I'm also am not eager to add them without a good/clean story for how they'd be defined by a user on their own type
In the perf meeting today, we (@ronawho, @ian-bertolacci, @benharsh) discussed a few use cases that might motivate supporting them:
-
If we move toward supporting operator overloads for common atomic operations, then
+=
would correspond to a.add()
, but if we had++
, that could support the common case of a.fetchAdd(1)
nicely. -
@benharsh points out that these could be useful in bucketing patterns like ISx as well.
from chapel.
This SO Q&A which seems to summarize Swift's choice not to support these operators was interesting to me.
from chapel.
Related Issues (20)
- [Bug]: mason `add` requires manual clone of registry
- [Bug]: 'mason publish' fails to add tags for remote package repo HOT 2
- [Bug]: Hexadecimal Floating Point Output Format HOT 14
- [Feature Request]: should `mason doc` add `/doc` to .gitignore HOT 1
- [Feature Request]: Allow anonymization of the output when calling `chpl --print-chpl-settings` and friends? HOT 1
- Proposal: Disallow spaces after @ for attributes HOT 6
- [Bug]: building chapel-py-venv removes sphinx-build binary HOT 5
- [Bug]: internal error calling promoted function with default values and actual reordering
- [Bug]:Ternary Operator in return statement causes (subsequent) stack corruption HOT 14
- [Bug]: Ignoring the return value of a type function results in a compiler segfault
- [Bug]: Reductions over distributed arrays in default arguments cause compiler segfaults HOT 1
- [Feature Request]: show instantiations for records/classes as well functions in CLS
- [Feature Request]: show defaulted parts of types in CLS type hints
- dyno: odd issue when calling `init` without `this`
- [Bug]: Error compiling Chapel-Py HOT 3
- [Bug?]: Inconsistency with c_array documentation and c_array behavior w.r.t. coercion to c_ptr HOT 1
- `source` field required in `Mason.toml` for registration, misleading documentation HOT 2
- should `checkModule` in `masonPublish` only count files? HOT 2
- [Bug]: Forwarding to a badly formatted `var` declaration causes an internal error
- [Bug]: `mason new` does not start an interactive session HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chapel.