Hi,

> If we keep the ~-expansion, any safe code that use the filesystem API
> will have to resort to tricks like 
> 
>   (operation (if (absolute-pathname? the-path)
>                  the-path
>                  (make-pathname (current-directory) the-path)))
> 
> to guard against input that would cause unintended expansions.  In the
> end, we'd have just the opposite of convenience (obviously, _if_ you
> _remember_ to use the trick to avoid expansions).

Thank you for demonstrating how that kind of API also tends to breed broken
workarounds due to cognitive overload.

Your code has a potential race condition, as your CWD can be renamed and a
different directory placed at the old name in between current-directory and
the subsequent pathname resolution performed by operation, so the semantics
would differ from a non-expanding operation.

Given that there is qs for shell quoting, why not have something similarly
short for (partial) shell expansion, so it's reasonably easy for
interactive use?

Regards, Florian

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to