|Re: (Fully)?QualifiedName [message #898787 is a reply to message #898746]
||Fri, 27 July 2012 14:49
| Henrik Lindberg
Registered: July 2009
The QualifiedName is used to name things, and for expressing a reference |
to a named item. It is the responsability of Scoping of presenting
eligible candidates for referencing existing elements, and the
responsibility of "Containers" to manage the overall visibility of
elements to scoping.
By default everything that has a "name" feature is exported and gets a
fully qualified name based on its containment. Containment comes in
different flavors - using OSGi/Java classpath, Eclipse project
depedencies, etc. (You configure how you want this to work in your
language - it is in the documentation).
Scoping has many possibilities, and documentation does not really
contain any recipes - but search this forum for pointers to blog posts
and examples on Scoping.
You also have to decide on if you want to use an import scheme (like
java) to prevent requirement on having a fully/semi qualified named
reference when there are ambiguities. I.e. if you reference using "a"
and when the code is written there is only one "a" but later there are
several "a" to chose from and none is closer to the other in scoping to
the current position. If your different "a"'s then have very long names,
you may not want to have to type "org.foo.bar.this.that.the.other.a"
whenever you want to use a specific "a". Hence, java import that
specifies an alias.
Using import naturally makes scoping simpler - every name has to be
found in the scope(s) defined in one resource. And you can resolve the
imports separately (also subject to ambiguities btw depending on which
container configuration you use).
Hope that helps.
On 2012-27-07 14:39, Quentin Boucher wrote:
> I am quite new to Xtext and trying to implement my language.
> In this language users should be able to use partially and fully
> qualified names. For example, one could use foo.bar.xyz, bar.xyz or xyz
> to reference xyz. The user must use the name which uniquely identifies
> the element since elements might have the same names. For example, the
> user could define a second xyz in bar2. That one would have bar2.xyz as
> unique identifier. However, the user could also use foo.bar2.xyz to
> identify it. She can also use the fully qualified name even if xyz was
> unique. I have read a bit about "QualifiedNameValueConverter" but I
> don't know if this is the right way to go?
> Additionally, the user can use shortcuts like "this", "parent",...
> Thank you for your help!
Powered by FUDForum
. Page generated in 0.02712 seconds