[Aldor-l] [fricas-devel] conditional exports and aldor compilation

Ralf Hemmecke ralf at hemmecke.de
Wed Dec 7 19:52:54 EST 2011


Just for the record... and in continuation of 
http://groups.google.com/group/fricas-devel/browse_thread/thread/c7d1c908a07758d2

The following seems to reveal a weakness of the Aldor compiler.

In ax.boot I've set the $pretendFlag to false.

axFormatCondOp op ==
   $pretendFlag:local := false
   axFormatOp op

This, however, prevents the compilation for HOAGG.ap.

"ap/HOAGG.ap", line 15:
                 (|If| (|Test| (|Has| |#1| (|Apply| |Evalable| |#1|)))
..............................................................^
[L15 C63] #1 (Error) Argument 1 of `Evalable' did not match any possible 
parameter type.
     The rejected type is Type.
     Expected type SetCategory.

The original lines are
https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/aggcat.spad.pamphlet#L113

HomogeneousAggregate(S:Type): Category == Aggregate with
    if S has CoercibleTo(OutputForm) then CoercibleTo(OutputForm)
    if S has SetCategory then SetCategory
    if S has SetCategory then
       if S has Evalable S then Evalable S
    ...

The HOAGG.ap file does not look bad.

                (|If| (|Test| (|Has| |#1| |SetCategory|))
                 (|If| (|Test| (|Has| |#1| (|Apply| |Evalable| |#1|)))
                  (|Apply| |Evalable| |#1|) NIL)
                 NIL)

whereas the code generated with "$pretendFlag:local := true" is:

                (|If| (|Test| (|Has| |#1| |SetCategory|))
                 (|If|
                  (|Test|
                   (|Has| |#1|
                    (|Apply| |Evalable| (|PretendTo| |#1| |SetCategory|))))
                  (|Apply| |Evalable| (|PretendTo| |#1| |SetCategory|)) NIL)
                 NIL)

Obviously, the Aldor compiler is here weaker than the SPAD compiler.
 From my understanding of Aldor

    if S has SetCategory then
       if S has Evalable S then Evalable S

should compile just fine without manually doing something like

    if S has SetCategory then
       if S has Evalable(S pretend SetCategory) then Evalable S

:-(

Ralf



More information about the Aldor-l mailing list