GordonCharlton / Quackery

a lightweight, open-source language for recreational and educational programming inspired by Forth and Lisp
http://rosettacode.org/wiki/Category:Quackery
34 stars 6 forks source link

Path support for file operations #2

Closed olus2000 closed 2 years ago

olus2000 commented 3 years ago

Resolves #1

This is a proposed fix to #1 my issue regarding Quackery's file operations, especially loadfile. It uses a very nasty bit of python code in the new share_path function but I don't see how to implement this without needing to access ancillary stacks from python code or how to access ancillary stacks in a cleaner way.

One of the commits also includes a single line change of the matchwith word to nest the predicate which allows the use of done inside it without breaking the loop.

olus2000 commented 3 years ago

I found a cleaner share_path. It is still big because in order to emulate actually getting the top item from a stack I used code similar to that of take. With some assumptions most of that code can go away, but that can end up with the user getting some weird error messages when path is incorrect (empty file.path or non-string value at the top).