triska / clpz

Constraint Logic Programming over Integers
https://www.metalevel.at/prolog/clpz
184 stars 15 forks source link

How to get changes in scryer's fork? #28

Open jeshan opened 9 months ago

jeshan commented 9 months ago

Currently, I'm using clpz with sicstus and not scryer. I see that there are many enhancements being done in the scryer fork but not in this repo. https://github.com/mthom/scryer-prolog/pulls?q=is%3Apr+clpz

I understood that it's because of the differences in sicstus and scryer implementations. Is there anything the community/ @triska can do to align both versions?

triska commented 9 months ago

@jeshan: Yes, I would greatly appreciate your help with porting newer developments from Scryer Prolog to the SICStus version!

I think a good way to do this would be a series of commits that correspond to the ones available in Scryer Prolog, and maybe even reference them. You can do this for example for the commits you find most relevant or interesting and which can easily be ported in this way. I think this would be a good starting point.

Another good approach would be to reduce the existing differences between the versions in a way that can be easily seen to be correct. For instance, one could start with lines that are comments in both files, and have one commit that reduces the differences between these comments in the source code.

Yet another approach could be useful for differences that arose only due to early limitations in Scryer Prolog that now no longer exist. For instance, at some point during its development, Scryer Prolog did not yet support the discontiguous/1 directive, and so I had to move clauses around to make them contiguous. Obviously, Scryer Prolog has now far surpassed this stage, and such a difference between the two versions is now no longer needed. This is an example where maybe the Scryer version could more closely follow the SICStus version again, if it is indeed preferable to keep the clauses discontiguous in the source code.

Thank you a lot to everyone who is interested in helping with this! If you have any questions, please let me know any time!

UWN commented 9 months ago

This particular PR does not include all the improvements that happened in Scryer so far. As an exemple:

| ?- X #= sign(-10).
! Domain error in argument 1 of user:unknown/1
! expected clpz_expression, but found sign(-10)
! goal:  unknown(sign(-10))

whereas in Scryer:


?- X #= sign(-10).
   X = -1.
triska commented 9 months ago

No PR is being filed here, this issue is the discussion about how to best synchronize the versions. A PR could be a result of this discussion.

jeshan commented 9 months ago

Understood. I guess it will have to be manual changes for a long while: I'm hoping that someday we'll have only 1 file to change!

@UWN did you intend to comment on issue #27 and not issue #28 ? Even so, I think #27 is for a different subject. Let me know so I look into it.

UWN commented 9 months ago

See my other comment. To me, it all looks the same...

triska commented 9 months ago

I have one general comment for porting changes: The focus should be on the commits that went into Scryer Prolog, not the PRs! That is: To port a commit that went into Scryer Prolog, it would be best to reference the commits by their hash and/or copy their descriptions, and maybe optionally also reference the PR (if there is one), because it may contain interesting discussion etc. But the commits are what counts because they are permanent, whereas PRs only make sense as long as Github exists.

triska commented 9 months ago

(It is OK to reference multiple commits in a single commit, if it makes sense to port the commits as a unit!)