How to work with For? #255
-
In C++, all parts of |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 13 replies
-
The missing expressions of the |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
As expected;
That sounds like a serious misuse of
Well, the only semantics of For the purpose of not-yet-implemented node, if the use of exceptions is not appropriate, I would suggest you want to mark each of those instances with specific nodes; for example, you could introduce your own dedicated implementation nodes, or you could create dedicated |
Beta Was this translation helpful? Give feedback.
-
Is IPR extensible? If I try to add a new node like Node is implemented like this:
The problem is, even if I add Do I miss something? |
Beta Was this translation helpful? Give feedback.
-
[Gabor]
[GDR]
so I would have expected the code to read
The visitor operates on the interface classes, so any class (including your own) that derives from those interface classes will be visited. Is that not happening? Why? |
Beta Was this translation helpful? Give feedback.
-
Because this is how overload resolution works in C++? Here is a minimalized example, but let me know if I am missing something:
|
Beta Was this translation helpful? Give feedback.
-
When you add that |
Beta Was this translation helpful? Give feedback.
-
From my point of view, it does not matter. Whichever can provide the behavior would be fine. But based on the discussion so far, I'm better off with an Interface node. |
Beta Was this translation helpful? Give feedback.
-
Gabor - You are still describing an implementation tactic without describing the real problem that you're trying to solve. In doing so, you seem to be hitting some walls that aren't necessarily there if we started from a shared understanding of what the real problem is. Can you start over again by describing the real problem, and then we work from there to possible solutions? |
Beta Was this translation helpful? Give feedback.
-
To provide more input into the problem. Tooling is currently built on top of the IPR interface with no connection to any implementation details so that this tooling can operate no matter what the underlying implementation is. I believe this is the key point that is missing in this discussion. Currently we can not construct a usable IPR tree from a extensive compiler such as Clang without having a method to produce dummy nodes for C++ constructs that do not yet exist or have limitation in the state of the IPR today. The implementation for Clang used Obviously this is a hack, these Unsupported nodes aren't first class citizens in the IPR but we need some way to materialize them so that we can progress with producing and using an IPR graph while the IPR specification is being defined and improved. To resolve this we could:
Option 2 appears to be what @GabrielDosReis is suggesting and that could be implemented with something like the example below. If we go down this route we would be creating what I would perceive as an ill defined IPR tree. These non-leaf nodes are clearly defined as abstract nodes and as a user looking at the interface I would have the expectation to never see an instance of these classes. namespace ipr::impl {
struct Not_impl_stmt : Node<ipr::Stmt> {
category = Category_code::Unknown
}} The idea of being able to create new Node not explicitly defined in the Interface and how that interacts with existing utilities that tools will be using such as Visitors or I suggest we go with option 2 but I am open to more thoughts. This will involve explicitly baking in the understanding that abstract Nodes can have implementations or child Nodes not defined in the interface so this is just replacing one hack with another one but at least we can make progress. |
Beta Was this translation helpful? Give feedback.
-
Thanks for this thoughtful write up. Very useful. As part of understanding the problem is, I have a question about this:
Would it make sense to work off those missing (equivalent IPR) types so we don't discovered down the line that there are other kinds of surprising uses that lead to the original question? |
Beta Was this translation helpful? Give feedback.
The missing expressions of the
For
should be thought as instances ofipr::Phantom
.ipr::Empty_stmt
shouldn't have been used there, regardless.