25.5 Aldor Pre- and Post-Description

Assume the following code has been put into a file aaa.as.

#include "aldor"  
+++ Pre-DomainA  
DomainA: with {  
+++ Pre-FOO  
        foo: () -> ();  
++ Post-Foo  
+++ Pre-BAR  
        bar: () -> ();  
++ Post-Bar  
} == add {  
+++ Impl-pre-FOO  
        foo(): () == never;  
++ Impl-post-Foo  
+++ Impl-pre-BAR  
        bar(): () == never;  
++ Impl-post-Bar  
}  
++ Post-DomainA

Then compile with the following call:

aldor -fasy aaa.as

the output with the 1.0.2 Aldor compiler is given below.

((|Declare|  
    |DomainA|  
    (|Define|  
      (|Declare|  
        ()  
        (|With|  
          ()  
          (|Sequence|  
            (|Declare|  
              |foo|  
              (|Apply| -> (|Comma|) (|Comma|))  
              ((|documentation| . " Post-Foo  
 Pre-FOO  
")  
                (|symeNameCode| . 314869119)  
                (|symeTypeCode| . 778822608)))  
            (|Declare|  
              |bar|  
              (|Apply| -> (|Comma|) (|Comma|))  
              ((|documentation| . " Post-Bar  
 Pre-BAR  
")  
                (|symeNameCode| . 315117424)  
                (|symeTypeCode| . 778822608))))))  
      (|Add|  
        ()  
        (|Sequence|  
          (|Define|  
            (|Declare|  
              |foo|  
              (|Apply| -> (|Comma|) (|Comma|))  
              ((|documentation| . " Impl-post-Foo  
 Impl-pre-FOO  
")  
                (|symeNameCode| . 314869119)  
                (|symeTypeCode| . 778822608)))  
            (|Lambda| (|Comma|) (|Comma|) (|Label| |foo| (|Never|))))  
          (|Define|  
            (|Declare|  
              |bar|  
              (|Apply| -> (|Comma|) (|Comma|))  
              ((|documentation| . " Impl-post-Bar  
 Impl-pre-BAR  
")  
                (|symeNameCode| . 315117424)  
                (|symeTypeCode| . 778822608)))  
            (|Lambda| (|Comma|) (|Comma|) (|Label| |bar| (|Never|)))))))  
    ((|documentation| . " Post-DomainA  
 Pre-DomainA  
")  
      (|symeNameCode| . 156793720)  
      (|symeTypeCode| . 274835655)  
      (|domExports|  
        (|Declare|  
          |foo|  
          (|Apply| -> (|Comma|) (|Comma|))  
          ((|documentation| . " Post-Foo  
 Pre-FOO  
")  
            (|symeNameCode| . 314869119)  
            (|symeTypeCode| . 778822608)))  
        (|Declare|  
          |bar|  
          (|Apply| -> (|Comma|) (|Comma|))  
          ((|documentation| . " Post-Bar  
 Pre-BAR  
")  
            (|symeNameCode| . 315117424)  
            (|symeTypeCode| . 778822608)))))))  
(|Sequence|)

Obviously, the compiler puts the +++ pre-descriptions after the ++ post-descriptions.

That is quite unintuitive, but it is the way the compiler currently behaves.

That is one of the reasons why there is only one form, namely a +++ environment which corresponds to +++ pre-description.

Another reason for having just one environment is that we want the inverse search feature to work, but still put the description in front of the actual code. If function signatures were to be documented using an environment that corresponds to a ++ post-description then we would have to reverse the order before NOWEAVE sees the file.