Comments (6)
In my view, the expectation that code after a halt()
will do anything is legacy. For today's Chapel, I see it "normal" to declare the return type explicitly rather than relying on return-after-halt.
Given the importance of abstract classes and pure virtual methods it makes sense to introduce language support for them. A library routine, an attribute, or some syntax (cf. init tnis
) are possibilities.
That said, if others find return-after-halt valuable, I can live with it.
from chapel.
Of course we can consider other ways to indicate something is pure virtual, such as an attribute or keyword. See also #8566 and #15271.
Given the importance of abstract classes and pure virtual methods it makes sense to introduce language support for them.
Good points and I would also prefer language support for pure virtual methods than continuing to use this pattern to fake it.
from chapel.
Tagging @vasslitvinov and @DanilaFe on this due to their involvement with #23309. Note that I consider this low priority (but worth capturing).
from chapel.
#20673 raises other related questions.
We should at the very least add a clarification to the spec here.
from chapel.
IMO for the specific pattern here, we could introduce a library routine to call to indicate a method is "pure virtual" / "abstract" and call that instead of halt
. Then, the compiler can be adjusted to not consider this to make the return
dead code. Of course we can consider other ways to indicate something is pure virtual, such as an attribute or keyword. See also #8566 and #15271.
I would also be open to an approach that uses such top-level return
s for type inference of routine return types even if there is halt
before it, possible as an exception to the general dead code / param folding rules.
from chapel.
I agree with Vass and think it would be reasonable for the language to detect and warn against this pattern, perhaps suggesting you annotate a return type instead. I also think it would be reasonable to try and warn for all unreachable code that is not being deliberately param folded away.
from chapel.
Related Issues (20)
- [Bug]: problems using a sibling module with module include
- [Bug]: Chapel/Fortran interoperability, internal compiler error HOT 1
- until <condition> do <statement> OR do <statement> until <condition> - Low Priority
- `--report-gpu` can report false positives
- Better error message for RectangularDomain.sorted()
- Ensure all CLS inlays respect
- How should 'require something.chpl' interact with finding the main module? HOT 6
- [Bug]: Type inlay hints are printed incorrectly for several types
- CLS: Enum values print as dyno ids instead of their name
- [Bug]: CLS does not treat complex numbers as literals HOT 4
- [Bug]: CLS should not crash when resolving `string`
- [Feature Request]: CLS - mark unused functions/records/modules/variables as unused
- [Feature Request]: CLS - don't show generic code lenses when a function has a single instantiation
- [Feature Request]: Integrate CLS better with Mason
- [Documentation]: Extend the Standard Module Style guide for other decisions we've made HOT 1
- [Bug]: Subprocesses interact strangely with `valgrind`
- Type Promotion Issue with Complex Types HOT 3
- Should forall loops over default arrays of locales result in coforall + on implementation by default?
- Simplify/specialize error message for calling a method on a nilable class variable
- Dyno asserts when casting a string to bytes
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.