Re: How to support annotations for a custom type in a C extension?

2021-09-17 Thread Marco Sulla
Ooook. I have a question. Why is this code not present in dictobject.c? Where are the dict annotations implemented? On Sat, 18 Sept 2021 at 03:00, MRAB wrote: > > On 2021-09-17 21:03, Marco Sulla wrote: > > I created a custom dict in a C extension. Name it `promethea`. How can > > I implement

Re: How to support annotations for a custom type in a C extension?

2021-09-17 Thread MRAB
On 2021-09-17 21:03, Marco Sulla wrote: I created a custom dict in a C extension. Name it `promethea`. How can I implement `promethea[str, str]`? Now I get: TypeError: 'type' object is not subscriptable Somewhere you'll have a table of the class's methods. It needs an entry like this: stati

How to support annotations for a custom type in a C extension?

2021-09-17 Thread Marco Sulla
I created a custom dict in a C extension. Name it `promethea`. How can I implement `promethea[str, str]`? Now I get: TypeError: 'type' object is not subscriptable -- https://mail.python.org/mailman/listinfo/python-list

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-17 Thread Mostowski Collapse
Concerning garbage collection, did a long term measurement for the first time. I measured LIPS for fibonacci numbers, i.e. time(fibo(23,X)). Doing the same thing 16 times, how long does it take? Here is a depiction how the LIPS relatively differ in each run: https://gist.github.com/jburse/c85297e9

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-17 Thread Mostowski Collapse
No its cooperative. Usually objects do get garbage collected by the native garbage collector of the host language in Dogelog runtime. The Prolog garbage collection is only to help the host language garbage collector when you have a deep recursion in Prolog. You can then reclaim intermediate vari

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-17 Thread Mostowski Collapse
The Prolog garbage collection that does the movement on the variable trail is only a very small fraction of the runtime. The garbage collection time is measured. Some measurements with version 0.9.5 took the following values: %%% % Standard Pyt

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-17 Thread Greg Ewing
On 16/09/21 6:56 am, Mostowski Collapse wrote: What could be slow, repeatedly requesting the "args" field. Maybe I should do: help = term.args i = 0 while i < len(help) - 1: mark_term(help[i]) i += 1 term = help[i] Yes, that will certainly help. But you're still evaluating len(help) -

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-17 Thread Mostowski Collapse
Thanks for your response, will have a look. Ok, dis() is all that is need to disassemble. Very cool! A long term goal could be indeed to have a Prolog interpreter produce 20MLips, like SWI-Prolog, but tightly integrated into Python. So that it directly makes use of the Python objects and the Py