Hallo all,
I observed the following behaviour. Perhaps someone can tell what is
going on, a bug of philosophy which I do not understad? If necessary I
can work out and provide a minimal example.
1. defined a category IML with several functions, all of them are
implemented in the category, some of them use local pointer variables of
the form
pF1: Reference Boolean := ref false
in the add-part of the category
2. implemented domains (eg. DatabaseTable) which use this category via
Join(IML, ...) with ..
it works like designed: I can set from outside new values to the
Reference values, and then on the Boolean values depending functions of
the domain the set values
(from outside) are used and change the behaviour of the functions.
(mainly: information on intermediate values of variables)
3. implemented a package which use this category via IML with ...
Different behaviour: alll function codes from IML are available as
signatures of the package, there compiled code from IML- is available
and can be executed. The internal
variables - as in 2. - can be set from outside, the functions which
return the actual values show the changed values. HOWEVER, the code of
other functions in the package
do not realize, that the derefenced values are changed -- CONTRARY
to the identical settings in the domain case of 2. Then, the attempt to
repeat the definitions as
pF1: Reference Boolean := ref false
in the add-part of the package does NOT CHANGE this behaviour.
However, in this package a domain(DatabaseTable) which also has the category
IML implemented, is imported. Executed code now uses THE internal
values of pF1 of this domain for the execution of a function from the
package. Can it be, that the compiler
is confused and uses the wrong variable? This suspicion is confirmed
when I finally did a package call to % explicitly.
Here a protocol of the working example in a domain DBT:
(72) -> setMessageLevel(0)$DBT
(72) 0
Type:
NonNegativeInteger
Time: 0.00 (OT) =
0.00 sec
(73) -> variableColumn(STCL, "Augenfarbe")
(73)
["braun", "braun", "braun", "braun", "braun", "blau", "braun", "braun",
"gruen", "gruen", "gruen", "blau", "blau", "blau"]
Type:
Vector(Union(Float,Integer,String,null))
Time: 0.00 (OT) =
0.00 sec
(74) -> setMessageLevel(3)$DBT
(74) 3
Type:
NonNegativeInteger
Time:
0 sec
(75) -> variableColumn(STCL, "Augenfarbe")
variableColumn: var = "Augenfarbe"
variable? true
(75)
["braun", "braun", "braun", "braun", "braun", "blau", "braun", "braun",
"gruen", "gruen", "gruen", "blau", "blau", "blau"]
Type:
Vector(Union(Float,Integer,String,null))
Time:
0 sec
Note the different info in red according to the changed internal
Reference value.
Now the package, the crucial part of the implementation in the package
CLAP is
print blankSeparate ["messageLevelPointer = ", (mLP 3)::OF] -- always is
printed, however, calls pF3 from domain DBT
if mLP(3)$% then print equalLine() -- uses the local variable pF3
if mLP 3 then print blankSeparate ["x = ", x::OF] -- uses the external
local variable pF3 from imported domain DBT
My expectation would be that not package called code should use the
local variables of the package and not those of other imported domains!
(108) -> messageLevelPointer(3)$CLAP
(108) false
Type:
Boolean
Time: 0.00 (IN) + 0.01 (OT) =
0.01 sec
(109) -> messageLevelPointer(3)$DBT
(109) false
Type:
Boolean
Time: 0.00 (OT) =
0.00 sec
(110) -> initialCondorcetClustering([i for i in 1..14], aev)$CLAP
messageLevelPointer = false
messageLevelPointer = false
(110) [[1,4,6,7],[2],[3,5,8,14],[9,10],[11],[12,13]]
Type:
List(List(Integer))
Time: 0.15 (EV) + 0.04 (OT) =
0.20 sec
(111) -> setMessageLevel(3)$CLAP
(111) 3
Type:
NonNegativeInteger
Time:
0 sec
(112) -> messageLevelPointer(3)$CLAP
(112) true
Type:
Boolean
Time:
0 sec
(113) -> initialCondorcetClustering([i for i in 1..14], aev)$CLAP
messageLevelPointer = false
========================================================================
messageLevelPointer = false
========================================================================
(113) [[1,4,6,7],[2],[3,5,8,14],[9,10],[11],[12,13]]
Type:
List(List(Integer))
Time: 0.14 (EV) + 0.05 (OT) =
0.18 sec
(114) -> messageLevelPointer(3)$DBT
(114) false
Type:
Boolean
Time: 0.00 (OT) =
0.00 sec
(115) -> setMessageLevel(3)$DBT
(115) 3
Type:
NonNegativeInteger
Time: 0.00 (IN) + 0.00 (OT) =
0.00 sec
(116) -> initialCondorcetClustering([i for i in 1..14], aev)$CLAP
messageLevelPointer = true
========================================================================
x = 1
------------------------------------------------------------------------
finished cluster loop with
lC = []
nlC = []
found new better Condorcet value = 1
for better clustering = [[1]]
actual clustering = [[1]]
messageLevelPointer = true
========================================================================
x = 2
C = [1] i = 1 -- actual C union x is lC = [[2,1]]
found new better Condorcet value = 0.7
for better clustering = [[2,1]]
------------------------------------------------------------------------
finished cluster loop with
lC = [[1]]
nlC = [[2,1]]
found new better Condorcet value = 0.8
for better clustering = [[1],[2]]
actual clustering = [[1],[2]]
messageLevelPointer = true
========================================================================
(116) [[1,4,6,7],[2],[3,5,8,14],[9,10],[11],[12,13]]
Type:
List(List(Integer))
Time: 0.14 (EV) + 0.05 (OT) =
0.19 sec
--
Mit freundlichen Grüßen
Johannes Grabmeier
Prof. Dr. Johannes Grabmeier
Köckstraße 1, D-94469 Deggendorf
Tel. +49-(0)-991-2979584, Tel. +49-(0)-151-681-70756
Tel. +49-(0)-991-3615-141 (d), Fax: +49-(0)-3224-192688
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.