Tech projects, hobby programming, and geeky thoughts of Paolo Amoroso

Stumped with URL validation in WebCard

I started working on URL validation in WebCard and soon bumped into a bug.

When creating a new Web card, WebCard prompts for a URL to store in the card. I wrote the predicate WCD.ValidURLP to do some minimal validation and make sure the input resembles a URL. For example, the function checks whether the input starts with https://, http://, or mailto:. Although I don't want to write a URL parser I ended up adding more logic than anticipated.

I could skip URL validation altogether and defer error cheking and reporting to the web browser. Or allow URLs with no URL scheme such as interlisp.org that a browser can handle. But it's probably better to have full URLs as a form of card documentation.

Next I tried calling WCD.ValidURLP from WCD.AskURL, the function that prompts for a URL in a loop until the input is valid. An Interlisp iterative statement with a bind clause controls the loop.

But I'm getting syntax errors for bind in the statement. I checked the documentation, read sample code, and tested a few variations.

I'm still struggling with this.

#WebCard #Interlisp #Lisp

Discuss...
Email | Reply @amoroso@fosstodon.org