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

Mostowski Collapse janburse at fastmail.fm
Thu Sep 16 15:56:49 EDT 2021


About Exceptions: Thats just building ISO core
standard Prolog error terms.

About Garbage Collection: Thats just Prolog
garbage collection, which does shrink some
single linked lists, which ordinary
programmig language GC cannot do,

or maybe some Weak Pointer magic can do it?
The use case is very simple. A Prolog system
has a so called trail. The trail in Dogelog
Runtime is a single linked list:

     -->[ A ]-->[ B ]-->[ C ]-->

Now if B becomes unused, you need to rewire
the trail, it should then look like:

     -->[ A ]---------->[ C ]-->


If a programming language has a means to
communicate this to the Garbage Collector,
I happy to apply it. The challenge is many
fold, the pointer from A to B for example

needs not to be accounted to determine
whether B is reachable. So all the links
in the trail are weak pointers. But they
are weak pointers that need to

be able to adapt.

Chris Angelico wrote:
> On Fri, Sep 17, 2021 at 3:20 AM Mostowski Collapse <bursejan at gmail.com> wrote:
>>
>> Compound is not used for boxing. Integers and floats
>> are represented directly. Also integers are not mapped to
>> floats. But maybe compound could be a little flattened,
>>
> 
> "Boxing" in this case isn't about ints and floats, since Java-like
> bizarrenesses simply don't happen in Python; I'm talking about the way
> that you frequently build up a Compound object for various situations
> (even for throwing an error - you have a function that constructs a
> generic Exception, and then buries a Compound inside it), and then
> you're frequently checking if something is an instance of Compound.
> All these constant back-and-forths are extremely expensive, since
> they're not part of your algorithm at all.
> 
> At very least, use tuples instead of Compounds, but it would be far
> better to ask less questions about your data and do more things by
> tidying up your algorithm. Unfortunately, I can't really advise with
> any detail, because you have code like this:
> 
> ###
> # Mark a term.
> #
> # @param term The term.
> ##
> def mark_term(term):
> 
> What does that even mean?! I get it, you have a term, and you're
> marking it. Whatever that mark means. The comments add absolutely
> nothing that the function header didn't tell me. Are you implementing
> your own garbage collection on top of Python's? Or something else?
> It's extremely hard to give any sort of recommendations when your code
> is hard to read, and nearly all of the comments are nothing more than
> restating what can be seen in the next line of code. Also, with the
> number of globals you're using, tracing the purpose of your functions
> is not easy.
> 
> ChrisA
> 



More information about the Python-list mailing list