(partially) closed Ctree works with Test_Isac
authorWalther Neuper <wneuper@ist.tugraz.at>
Thu, 22 Dec 2016 10:39:45 +0100
changeset 59277ea0691a897ad
parent 59276 56dc790071cb
child 59278 a474900d5bd2
(partially) closed Ctree works with Test_Isac

Notes:
# without this specific "open Ctree" (and with "! activate for Test_Isac", as usual not commited)
e.g. "fun locatetac" always takes the 1st definition (i.e. "end-of-calculation")
# test/../open-structure.sml demonstrates this behaviour TODO
src/Tools/isac/Interpret/ctree.sml
test/Tools/isac/ADDTESTS/open-structure.sml
     1.1 --- a/src/Tools/isac/Interpret/ctree.sml	Thu Dec 22 10:25:49 2016 +0100
     1.2 +++ b/src/Tools/isac/Interpret/ctree.sml	Thu Dec 22 10:39:45 2016 +0100
     1.3 @@ -2506,4 +2506,6 @@
     1.4  (**)
     1.5  end
     1.6  (**)
     1.7 +(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
     1.8  open Ctree
     1.9 +( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/Tools/isac/ADDTESTS/open-structure.sml	Thu Dec 22 10:39:45 2016 +0100
     2.3 @@ -0,0 +1,40 @@
     2.4 +(* minimal example on problem with open structure *)
     2.5 +
     2.6 +signature PERVASIVE =
     2.7 +sig
     2.8 +  datatype foo = Foo of string
     2.9 +end
    2.10 +structure Pervasive : PERVASIVE = (* e.g. Ctree : CALC_TREE *)
    2.11 +struct
    2.12 +  datatype foo = Foo of string
    2.13 +end
    2.14 +(* this here is required in order to get "evaluated with def.2": open Pervasive *)
    2.15 +(* TODO un-comment ...                                           ^^^^^^^^^^^^^^ *)
    2.16 +
    2.17 +signature OPENED =
    2.18 +sig
    2.19 +  val bar_opened : 'a list -> Pervasive.foo
    2.20 +end
    2.21 +structure Opened : OPENED = (* e.g. Lucin : LUCAS_INTERPRETER *)
    2.22 +struct
    2.23 +  open Pervasive
    2.24 +  fun bar_opened [] = Foo "evaluated with def.1"
    2.25 +    | bar_opened (_ :: _) = Foo "evaluated with def.2"
    2.26 +end
    2.27 +
    2.28 +signature CLOSED =
    2.29 +sig
    2.30 +  val bar_closed : 'a list -> Pervasive.foo
    2.31 +end
    2.32 +structure Closed : CLOSED = (* e.g. Math_Engine : MATH_ENGINE *)
    2.33 +struct
    2.34 +  fun bar_closed [] = Pervasive.Foo "evaluated with def.1"
    2.35 +    | bar_closed (_ :: _) = Pervasive.Foo "evaluated with def.2"
    2.36 +end
    2.37 +
    2.38 +(* test/Tools/isac/* ..*)
    2.39 +open Pervasive;
    2.40 +open Opened;
    2.41 +open Closed;
    2.42 +bar_closed [1] = Foo "evaluated with def.2"; (* .. one should be def.1 ..TODO *)
    2.43 +bar_opened [1] = Foo "evaluated with def.2"; (* .. one should be def.1 ..TODO *)