Τρίτη 10 Μαΐου 2016

Αναθεώρηση 10.

Σε μεγάλες εκδόσεων (ακόμα και αυτή του 0.1)  υπάρχουν ασυμβατότητες με τις παλιές εκδόσεις..και αυτή την εποχή τις βρίσκω και τις διορθώνω.

Διορθώθηκαν οι Στατικές (και μάλιστα έβγαλα τον περιορισμό που είχα εδώ και καιρό βάλει για να μην έχουμε στατικές στις συναρτήσεις αντικειμένου τύπου ομάδα).



Form 80,50
Report {Test for static variables in modules in groups
            Static variables are bind to execute object
            Each module/Function can be run in different execution object
            But allways  a series of specific execution objects  occur
            So if A call B then  B has allways the same static variables
            But if C call B then B use another set of static variables
            So in group K module b, static k first time get value 1000
            If any new execution object call this module then an new K created
            }
Call Clear \\  clear all variables including static - hide this and execute this module two or more times.
module M {
      Read &MM
      call MM.b
      modules ?
}
Group k {
      module b {
            read klm
            static k=1000
            k=k+1
            print format$("a({1}).b.k={0}", k , klm)
      }
      module c {
            read klm
            static k =5000
            k=k+1
            if klm>=0 then {
            print format$("a({1}).c.k={0}", k , klm)
            } else {
            print format$("kk.c.k={0}", k)
            }
      }
}
dim a(10)
a(2)=k
a(4)=k
for i=1 to 2 : a(2).b 2: next i
for i=1 to 2 : a(4).b 4: next i
for i=1 to 5 : a(2).c 2 : next i
for i=1 to 5 : a(2).c 2 : next i
for i=1 to 5 : a(4).c 4 : next i
a(5)=a(2)
for i=1 to 5 : a(5).c 5 : next i
kk=a(5)
for i=1 to 5 : kk.c -1 : next i
module aaa {
      read &klm
      \\ static change because we are in a new process
      klm.c -1
}
Function moufa {
      Print "static is the same because we are in same process"
      \\ it is a fake function, is like Sub, but Function is in a list o functions, and can change definition
      \\ but a Sub is code, and every time we call interpereter search from the end to start.
      \\ Subs use all memory for retrun stack, so we can do nice things also.
      kk.c -1
      Print KM
}
      Print "New process object"
aaa &kk
checkme()
Print  "ok, look lazy now"
KM=100
aa$=Lazy$(&moufa())
link weak aa$ to aa()


For i=1 to 2 {
  Call aa()
}
Print "continue in aaa"
aaa &kk
Sub checkme()
            Print "static is the same because we are in same process"
            kk.c -1
End Sub


Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου

You can feel free to write any suggestion, or idea on the subject.