Comments (6)
@mppf mentioned that compilerError
has an errorDepth overload that will do what I want. Perhaps Debug.badArgs
can take an argument with a similar argument that defaults to 2. Will verify that this works before closing issue.
from chgl.
@mppf I am having a bit of an issue here because technically the errorDepth is a bit dynamic, but easily provable at compile time. Lets say that each time a function is called a compile-time counter is incremented and when a function exits it gets decremented. This would be enough to obtain the errorDepth
, but it seems that this isn't possible? Whenever I attempt to make a global param
and then use it in a function I get a 'used before defined' compiler error. The function I am trying to use can be seen below...
chgl/src/modules/AdjListHyperGraph.chpl
Lines 1001 to 1003 in 893ccf7
It does not include the dynamic compile-time counter yet as it will not compile. Any assistance with this? The ability to provide custom errors for the user was actually one of the highlights we made for the language (in the paper and presentation on CHGL), it would be nice to have this ability back.
from chgl.
I am having a bit of an issue here because technically the errorDepth is a bit dynamic, but easily provable at compile time.
Can you say what the actual issue here is?
Lets say that each time a function is called a compile-time counter is incremented and when a function exits it gets decremented.
You can't modify a param
variable.
from chgl.
Can you say what the actual issue here is?
We describe vertices and edges via a wrapper (record
that contains a type
which determines whether the wrapper refers to a vertex or edge), but we also allow implicit type conversions for integers of the same width and signed-ness. Hence we perform type-checking a bit late, sometimes after multiple function calls (a function f
can call g
which calls h
which finally does type-checking) which would need to propagate the type error down to where the user invoked the original function (f
in this example).
The issue is that since we have internal functions calling other functions, which may vary in depth, it wouldn't be correct to hard-code the actual errorDepth
(for example, the sequence f -> g -> h
is valid but so is g -> h
or even just h
). I suppose one way to resolve this would be to perform type-checking of these implicit casts early or add explicit types (rather than inferred) to enforce a more predictable type-checking from the compiler, but since we allow conversions between integers and their wrappers, if we had N arguments, we'd need to make 2^N + 1 overloads... Example...
proc hasInclusion(v : vIndexType, e : eIndexType) {
const vDesc = toVertex(v);
const eDesc = toEdge(e);
return getVertex(vDesc).hasNeighbor(eDesc);
}
proc hasInclusion(vDesc : vDescType, e : eIndexType) {
const eDesc = toEdge(e);
return getVertex(vDesc).hasNeighbor(eDesc);
}
proc hasInclusion(v : vIndexType, eDesc : eDescType) {
const vDesc = toVertex(v);
return getVertex(vDesc).hasNeighbor(eDesc);
}
proc hasInclusion(vDesc : vDescType, e : eDescType) {
return getVertex(vDesc).hasNeighbor(eDesc);
}
proc hasInclusion(v, e) {
Debug.badArgs((v, e), ((vIndexType, eIndexType), (vDescType, eDescType), (vIndexType, eDescType), (vDescType, eIndexType)));
}
Why do we have Debug.badArgs
to begin with if the compiler can emit its own error?
The compiler's default errors are ambiguous and vague at times, and very frustrating to work with at times. Custom and tailored error messages like this make it much easier to figure out what is wrong.
Let me know if I was unclear in any way.
Edit: I should mention that toVertex
and toEdge
does its own type-checking as well as bounds-checking (if enabled).
from chgl.
This issue is stale and should either be closed or eventually resolved.
from chgl.
I wonder if it'd be sufficient to have something like compilerError that reported the line number at the module boundary (so ignored functions within the module with the compilerError).
from chgl.
Related Issues (20)
- *Fix* Array out of bounds error HOT 1
- *Fix* remove seg fault from having more than 2 data files
- Compute s-closeness via Dynamic Programming HOT 2
- Chapel Graph Library - Generalizations of HyperGraphs to the Extreme HOT 2
- Explicit Undirected and Directed Hypergraph Support HOT 9
- Unable to push changes to mandysack-patch branch HOT 1
- output files to not get created initially HOT 1
- Create CHGL Mason package HOT 1
- Make 'PropertyMap' distributed HOT 1
- remove of unused line HOT 2
- Improve documentation and provide scope HOT 5
- Remove 'writeln' statements HOT 1
- Support properties on nodes and edges HOT 3
- Document Connected Components HOT 2
- Export incidence matrix HOT 5
- Provide correct Module entrypoint for Makefile HOT 6
- List of GraphBLAS topics HOT 1
- Port to Chapel 1.23 HOT 3
- Feature Request: Generate Line Graph from Hypergraph HOT 3
- Unable to build with Chapel 1.22.1 and 1.22.0 HOT 3
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 chgl.