pyDatalog icon indicating copy to clipboard operation
pyDatalog copied to clipboard

what the actual ???

Open AdamVerner opened this issue 2 years ago • 1 comments

Hi, sorry for the subjective commentary, but i was assigned in one of my classes to work with this library and i must admit that in the many years I've been working with python I have never seen something so horrible as what i just came across.

Why is there a need to inspect the stack of calling function and inject local variables into the caller function instead of just returning them? Is there any specific issue that you are trying to work around? Because i cannot understand how would one benefit from doing something like that, except for maybe job security.

found this in the aforementioned assignment template.

image

On a serious note, It's really cool that you can actually do this kind of stuff in python, but unless this was a ioccc version of python id rather not see it. Could you please explain, what made you take the decision and choose this design pattern/python usage? Thank you

AdamVerner avatar Nov 06 '22 22:11 AdamVerner

To start with I want to thank @pcarbonn for the library.

I am just an occasional visitor of the repository, but I do use the library from time to time. I have an impression that the approach was driven by two considerations: 1) the syntax is just some additional meaning to existing constructions of the usual Python, so that you would not need to write your own programming language and just use the power of Python 2) and at the same time ability to run queries through pyDatalog.create_terms() + pyDatalog.load() + pyDatalog.ask() and not to use eval() in Python for that (so that the query could come from a user input).

I have never thought myself whether there is a more elegant way to achieve the same result, but that is rather straightforward.

Besides, the essence of the library is rather unique, the project has no commits for the last 5 years, so I wouldn't start a conversation with a lament that you "have never seen something so horrible as what i just came across". There are things that could be made better, but I personally don't have enough vision of the project to be sure what would be better and what not.

newtover avatar Nov 07 '22 22:11 newtover