Hello everyone,
A new release is available, which fixes 2 nasty bugs:
(1) there was a problem with the management of class dictionnary when
too many methods were added. If there is a real need, I will upgrade
3.2 as well, but I encourage everyone to switch to 3.3 :-)
(2) as was pointed out on the forum there were two problems with store
(list,any) = "store_add"
- it did not work at all (a dumb problem with function pointers)
- it is not compatible with store(list,integer,any,bool)
The dumb problem was easy to fix but the non-compatibility is
actually a design bug, which has been there from day 1 ! The
(undocumented) philosophy was that lists supported defeasible
additions or updates, but not both !
Here is what I propose (and what is implemented in 3.3.06):
- lists supports both :-) and you can mix them
- but: defeasible addition will raise an error if an allocation is
required, thus lists must be pre-allocated when defeasible additions
are required.
This means: use shrink(make_list(<size>, <type>, value), 0) to build
a list that can grow up to <size>
As an example, I join the two tests that I have added to the test set:
[essai() : void
->
let l1 := list<integer>(1,2,3,4), l := list<integer>(1,2,3,4) in (
store(l), // useless but harmless ?
choice(),
store(l, 1, 100, true),
try store(l, 1)
catch any printf("error caught"),
printf("before l = ~S \n",l),
backtrack(),
printf("after l = ~S \n",l),
check("list bk", l = l1)) ]
[essai2() : void
->
let l1 := list<integer>(1,2,3,4), l := make_list(100,integer,0) in (
shrink(l,0),
l :add 1, l :add 2, l :add 3, l :add 4,
choice(),
store(l, 1, 100, true),
store(l, 5),
printf("2 before l = ~S \n",l),
backtrack(),
printf("2 after l = ~S \n",l),
check("(2) list bk", l = l1)) ]
I will update the 3.3 documentation :-)
Cheers,
Mr ClaireBugs.