Replies: 2 comments 2 replies
-
Which version of Scryer Prolog are you using? Specifically, as of 5a3ee3a, using strings for file names should work (see #566). With the latest development version, I get: ?- open("test.txt", w, Stream). caught: error(domain_error(io_mode,w),open/4) This makes quite clear that In addition, I second what @aarroyoc wrote: It is best to use the predicates from |
Beta Was this translation helpful? Give feedback.
-
I agree the docs need to improve a lot. Because right now they're non-existent. It's also true that Scryer tries to be ISO compliant so any ISO compliant docs (books, tutorials,...) will mostly work. But I think we need to develop a tool to write the docs near the predicate definitions. SWI uses PlDoc, which allows them to have their docs online with hyperlinks and search and all that stuff. And also that tool can be used to generate the content of the On the errors, I don't know how to approach them. What you're getting are the ISO standard exceptions. You can catch them in your code and they will be the same and you can unify against the error. Right now the REPL (which is just Prolog) just catches everything and prints it. Take into account that the same system works for your exceptions. We could add more information for some common exceptions but I think it won't be enough. We can't derive more helpful information from the Prolog exception. We would need custom Rust code to track that information. And that would only work the predicates that are "magic" and are implemented in Rust. A bit tricky in my opinion. And all in all, exceptions are not that common in pure Prolog code (open is not pure, because I/O). And even if you want to do I/O we recommend using the library |
Beta Was this translation helpful? Give feedback.
-
Hi all. I am relatively inexperienced with Prolog and completely new to Scryer. This was my first interaction with the REPL:
... It went on like that for a while, but I think you get the picture. Eventually I went directly to the definition of open/4 in src/lib/builtins.pl and even that didn't quite help, as there are no comments. The wiki is blank, and I didn't see a link to online documentation in the README.
Contrast this with systems like SWI-Prolog:
Now, I'm aware my inexperience is mostly to blame for this, but I think more descriptive error messages and the ability to view documentation in the REPL would go a long way towards making the system friendlier.
error(domain_error(source_sink, "test.txt"), open/4)
is compliant with the ISO standard, but presents information in a format unfamiliar to programmers from other languages.I was going to make this an issue, but after reading more about Scryer, I see that the system is still under heavy development. I realize the main contributors may not want to start writing documentation which could change or even be completely reworked in future releases. And, maybe these error messages are perfectly readable to everyone else and it's just me :)
What do others think? Would a help/1 or similar be a worthwhile endeavor at this stage? If so, I'd be willing to contribute a PR or two.
Beta Was this translation helpful? Give feedback.
All reactions