Τρίτη 15 Ιανουαρίου 2019

Revision 30 Version 9.6

Two bug fixes.
One bug has to do with a fault when we make a fault; If we make a lambda function, then we get two things, the variable and the function. A Clear statement clear the variables, but no the modules/functions local to module. So what happen if we call the lambda function?
In 29 revision and before we get an immediate exit because of an exception which not trapped. So now we trap that exception, and this is the test program. We can use List to list variables, and Modules ? to list loaded/defined modules.


module checkit {
      a=lambda->100
      Print a()=100 ' true
      clear ' a erased, but not a()
      Try {
            Print a() ' can't call the lambda function
      }
      Print Error$ ' Internal Error in function a()
}
checkit

The second bug was more difficult to find it, but not difficult to fix (the problem of bugs isn't the fix time, but to find them). We have to make a SuperClass, an object from that SuperClass, and a pointer to that object. The problem was in line z=>Reset 100 with an error "Double use of SuperClass". We can't open a superclass (using For SuperClass { } two times or more in a nest For), but the fault was not for something like this. So now I found the bug and I fixed it. The same For z { .Reset 100 } was ok, so the bug was specific when we open it using z=>Reset 100. And with the fix forthat bug I am sure I fix another bug (hard to explain now).

Superclass alfa {
      Unique:
            counter=1
      Public:
            Value {
                  For SuperClass {
                        =.counter
                        .counter++
                  }
            }
            Module Reset (x){
                  For SuperClass {
                        .counter<=x
                  }                  
            }
}
a=alfa
b=alfa
Print a=1, b=2, a=3, a=4, b=5 ' true true true true true
\\ we have to use group(a) to get the group not the value
\\ we use ( ) to get a copy
z->(group(a))
Print eval(z)=6, a=7, b=8, eval(z)=9 ' true true true true
z=>Reset 100
Print eval(z)=100, a=101, b=102, eval(z)=103 ' true true true true
For z {
      .Reset 10
}
Print eval(z)=10, a=11, b=12, eval(z)=13 ' true true true true



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

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

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