Comments (6)
Should require "something.chpl"; impact the process of identifying the main module?
My instinct (before reading the rest of the OP) would be "no"βthat the intention of specializing things on the command-line w.r.t. the main module is that they are obvious candidates since the user called them out explicitly when compiling them; by contrast, I think of a require statement as a way to express dependencies that a client of the module may not necessarily be aware of, or need to be aware of, so it would seem odd if they were treated equivalently as a module on the command-line.
The one case that gives me pause is if I did chpl foo.chpl
and foo.chpl contained require "bar.chpl";
Since foo.chpl
is the only module the user named and contains the require, should bar be considered? Still seems odd to me, but less obvious than if, say, foo contained use Sort;
and Sort.chpl
contained require "bar.chpl"
.
Now I'll go read the rest of the OP.
Your point about the binary name being based on the main module strengthens my sense that requires shouldn't be searched for the main module.
should the module include path be consulted when processing something like require "something.chpl" or should it only be relative to the current directory?
I would think it should be consulted, for consistency with requirements of .h and .so/.a files, and because our current stance has been that require statements should talk more about what files are required than where they live on the file system (e.g., we haven't permitted require "-I β¦";
or require "-L β¦";
since the very earliest drafts of the feature.
should modules brought in as a result of require have their module initializers run even if they are not otherwise use or imported? Currently this is not the case, but that is a case where it differs from being included in the command line.
My intuition would be "no", similar to how we don't run initializers for unused modules in general (I believe).
I think the net effect of this is that we need to soften the language about require "foo.chpl";
being similar or equivalent to simply naming foo.chpl
on the command-line, does that sound right?
from chapel.
but I think it's reasonable to change that.
Me too.
Do you think we are OK here or on shaky ground?
I feel pretty fine about this personally. I think we're pretty far off the beaten path and that the current behavior could be considered dangerous/surprising if not buggy in design.
from chapel.
I generally agree that I don't think Chapel files brought in by require statements should impact the determining of the main module. I also agree that it's okay not to run the module's initializer if the module was not actually used.
The mention of tests that explicitly lock in that this is possible intrigues me though. Could you point me at them?
from chapel.
Thanks @bradcray.
We do have a test today that expects the main module to be potentially discovered through a require
but I think it's reasonable to change that.
I think the net effect of this is that we need to soften the language about
require "foo.chpl";
being similar or equivalent to simply namingfoo.chpl
on the command-line, does that sound right?
Yes, I think that's the most straightforward way to address it (as far as the spec is concerned). As I mentioned, there will be some tests we will need to update.
I am hoping that we can justify this change as clarifying the documentation & improving inconsistent behavior in a corner case. That said, it could be viewed as a breaking change. Do you think we are OK here or on shaky ground?
from chapel.
The mention of tests that explicitly lock in that this is possible intrigue me though. Could you point me at them?
One is test/modules/require/whichModsInit/bar.chpl
. I do not have a list of others yet.
from chapel.
It looks like those cases were added as futures because they were confusing (#5076). I think their .good files being updated and the .future files removed might have been a mistake, I don't see any discussion on the PR that removes the .futures of whether it is appropriate to do so (sorry for missing that in my review of #18724)
from chapel.
Related Issues (20)
- [Feature Request]: Remote variables: allow non-locale arguments to `on`. HOT 3
- [Feature Request]: let CLS return a list of definitions for overloaded functions HOT 1
- [Bug]: GPU codegen fails with ROCm 5.4.3 with --devel HOT 4
- remote variables: always execute initialization expression on target locale
- Can we provide a way to call a CUDA/HIP kernel directly from Chapel?
- module search path ordering and name conflicts with bundled modules HOT 3
- Low CUDA API call performance when called from Chapel through interoperability HOT 1
- [Bug]: compiler crash with Release+Asserts build of LLVM and GCC-7.5.0 HOT 1
- [Bug]: Syntax error near proc HOT 2
- [Bug]: confusing error message for unresolved call with where clause
- Allow users to specify comparators for `sort` with a first class procedure
- [Feature Request]: readLine(ref a: [], ...) to indicate reaching EOF
- [Feature Request]: allow to run specific tests from `mason test`
- Update Quick Reference doc to use `new blockDist()` HOT 3
- Make CHPL*_JEMALLOC setting(s) first-class / documented? HOT 8
- Remote-declared arrays and `forall` locality HOT 3
- Problems with running parallel operations within GPU kernels
- [Bug]: `make install` installs a `mason` with incorrect paths
- Should we have a global `CHPL_MEM` and `CHPL_JEMALLOC`? HOT 3
- [Feature Request]: Integrate `gpuSort` into `sort` 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.