Search found 241 matches

by Martin Meyer
3 Dec 2018 10:48
Forum: Visual Prolog
Topic: Object Disposal
Replies: 9
Views: 158

Re: Object Disposal

OK, fine, and thanks again for explaining everything so well!
by Martin Meyer
3 Dec 2018 1:29
Forum: Visual Prolog
Topic: Object Disposal
Replies: 9
Views: 158

Re: Object Disposal

Yes, thank you, I understand. My preceding post was insufficient. The solution, which I have in mind, in full, with both object reference and id facts, is like: interface someObj open core properties optRef : optional{someObj}. id : positive (o). end interface someObj %--- class someObj : someObj en...
by Martin Meyer
1 Dec 2018 11:50
Forum: Visual Prolog
Topic: Object Disposal
Replies: 9
Views: 158

Re: Object Disposal

Would it be cheaper in terms of runtime to create a physical copy of the ID instead of creating an additional object? The semi dead memory will not be reanimated by making a copy. Does memory::getInteger/1-> create a physical copy and is the below code a legal solution? interface myObj open core pro...
by Martin Meyer
28 Nov 2018 0:42
Forum: Visual Prolog
Topic: Object Disposal
Replies: 9
Views: 158

Re: Object Disposal

Reading it again a question is comming to my mind: Is inserting the object's ID in a list of vacant IDs bringing memory back to live from the finalize predicate? What exactly counts as bringing memory back to live?
by Martin Meyer
28 Nov 2018 0:19
Forum: Visual Prolog
Topic: Object Disposal
Replies: 9
Views: 158

Re: Object Disposal

Thomas, thank you for the detailed explanation! It is that I am actually using a finalizer in my real code: In my real program there are objects with positive ID numbers. I use these IDs as keys of an array. My program keeps creating and disposing objects as long as it is running. The size of the ar...
by Martin Meyer
26 Nov 2018 19:44
Forum: Visual Prolog
Topic: Object Disposal
Replies: 9
Views: 158

Object Disposal

Hello Thomas, the garbage collector has a problem to dispose the objects in below code (in VIP build 802). Please have a look. To begin with I take a working code version which creates a number of objects, calls garbageCollect/0 , and in doing so it outputs the number of alive objects. interface som...
by Martin Meyer
9 Oct 2018 18:10
Forum: Visual Prolog
Topic: Predicate arrayM::add/1->
Replies: 1
Views: 531

Predicate arrayM::add/1->

Hello Thomas,

I am not sure whether it is intended or you want to change it: The predicate arrayM::add/1-> does not return the index of the added element, but the index plus 1.
by Martin Meyer
3 Oct 2018 20:17
Forum: Visual Prolog
Topic: Accessing a txt file resource
Replies: 7
Views: 831

Re: Accessing a txt file resource

I supposed the constant in my example is null terminated, because the Language Reference says When creating a binary constant the compiler adds the EOS symbol immediately after this constant, which makes safe the directive usages like this: constants text : string = uncheckedConvert(string, #binincl...
by Martin Meyer
3 Oct 2018 14:33
Forum: Visual Prolog
Topic: Accessing a txt file resource
Replies: 7
Views: 831

Re: Accessing a txt file resource

Maybe the #bininclude compiler directive could help you. By it your text file can be included as a binary. The binary can be converted then to a string. To demonstrate it take for example main.pro as the text file. It is coded in UTF-8 with a leading byte order mark of 3 bytes. Create a new console ...
by Martin Meyer
11 Sep 2018 23:32
Forum: Visual Prolog
Topic: Class unionFind
Replies: 1
Views: 748

Class unionFind

Hello Thomas, in unionFind.pro is a predicate which does the path compression: predicates find_node2 : (node{@Node} Node) -> node{@Node} Component. clauses find_node2(Node) = Component :- Parent = Node:parent, if Node = Parent then Component = Node else Component = find_node2(Parent), Node:parent :=...
by Martin Meyer
24 Apr 2018 0:19
Forum: Visual Prolog
Topic: Memory corruption in finalizer
Replies: 7
Views: 2307

Re: Memory corruption in finalizer

I see. Thanks again for answering!
by Martin Meyer
23 Apr 2018 15:52
Forum: Visual Prolog
Topic: Memory corruption in finalizer
Replies: 7
Views: 2307

Re: Memory corruption in finalizer

I have an add-on question. Probably you can answer it too:

Is it legal in a finalizer to store the object (i.e. This) in a class fact and thereby abandon the disposal of the object?
by Martin Meyer
23 Apr 2018 15:12
Forum: Visual Prolog
Topic: Memory corruption in finalizer
Replies: 7
Views: 2307

Re: Memory corruption in finalizer

Thanx for the info, Thomas!

By now I got the feeling you have said before that exceptions are not raised to the outside of finalizers. But maybe it's déjà vu. I will try hard to not forget it again.
by Martin Meyer
20 Apr 2018 21:41
Forum: Visual Prolog
Topic: Memory corruption in finalizer
Replies: 7
Views: 2307

Memory corruption in finalizer

Hello Thomas, please have a look at below example (in VIP 8 build 801). It creates a number of instances of an object type. The object has a nondeterm fact named keyValFact . In the object's constructor one exemplary key-value pair is asserted to the fact. In the finalizer it is checked whether the ...
by Martin Meyer
3 Apr 2018 23:18
Forum: Visual Prolog
Topic: Conflicting class & domain declarations: font
Replies: 2
Views: 1679

Re: Conflicting class & domain declarations: font

Hello Harrison, I have found two font interfaces in the pfc (of VIP 8 build 801). One is in the namespace gdi . If you mean this one, code it like class predicates drawDown : (pieCalc::pieSectorInfoDOM*, graphics, gdi\font, gdiplus::rectF). The other font interface is in no namespace. For that one y...