Re: [handly-dev] Element references
First, let me emphasize that handles are always precise. I mean there can be no ambiguity of where in the containment tree of the entire model an element represented by a handle is located. Thus, if you need to find an element in the model, the handle representing that element is the search result, so (as you hinted at) there would be completely no sense to use it a search argument.
That said, you can still model the element reference as a handle (representing the element reference itself). Its parent would be the source construct containing the reference. Sometimes it makes sense, sometimes it does not.
For example, you could, in theory, model the type reference of a variable as a handle whose parent would be the variable declaration and whose name would be the type name as expressed in the source. It would make sense to represent the type reference as a handle if, for example, you needed to show it as a separate element in the outline. In this case you probably don't, so it's probably more effective to simply have a method like String getType() in the variable declaration.
I think it really depends on the specific model. You can safely continue to use your reference classes if that's what makes sense to you in your model. There is nothing inherently wrong with that.
In the model API there will usually be methods like findElement(ref), where ref is an object describing the element. IHandles would be perfect to be used for that purpose, but they can't be created outside the model (i.e. they need to have a parent, and it's basically what the findElement is meant to provide...
I am currently using separate reference classes, but it doesn't feel completely ok. Is this the way to do it anyway, or is there a trick that I'm missing?