gsdlab / clafer

Clafer is a lightweight modeling language
http://clafer.org
MIT License
45 stars 13 forks source link

Optimize away navigation paths to clafers with global cardinality <= 1 #75

Open mantkiew opened 9 years ago

mantkiew commented 9 years ago

Often in models with deeply nested structures, referring to a nested clafer requires long navigation paths, which contain costly . operations. However, when the referred clafer has global cardinality <= 1, then he path can be omitted and the clafer can be referred to globally.

For example

a
   xor b ?
      c 
      d
           e
[ a.b.d.e ]

can be optimized to

[ e ]

that is, e can be accessed the same way as a top-level clafer (e.g., a).