Closed hostilefork closed 4 years ago
A bit of a loss, but good things coming out of it!
https://forum.rebol.info/t/default-with-predicates-the-must-match-constraint/1393
I'm a bit sorry about this, as I did push for usage of this feature...and modified code such as httpd.reb
to use it (for instance).
BUT... (and this is a big BUT...) because httpd.reb is set up for testing and I know where it is to fix it, I can fix it. And did!
https://travis-ci.com/github/metaeducation/rebol-httpd/builds/199046879
So there is (and has been) a path for keeping projects working, and having me sync them up. But the price of doing business is to have those repos be published where I can fix 'em, and have CI running on them!
A trick was explored which allowed DEFAULT to become a "skippable left-quoting enfix operator". It gained an additional feature of being able to be used in CASE or SWITCH:
The core of the trick was to make this behave exactly like:
It simply noticed when its left-hand side wasn't a SET-WORD!, and would decay to this behavior. The behavior of CASE and SWITCH to let the last condition value "fall out" if there was no associated code block to run allowed it to work.
HOWEVER in the era of predicates, the issue becomes more complex. As a simple example:
The mechanim collapses. It also points to a question about fallout in general...showing it cannot let the input to the predicate fall out, but only the output...which is less useful.
It also had a problem in its interaction with CASE/ALL, because it meant the DEFAULT would be run as well...even if no other branches ran.
While exploring this feature was a good exercise, it stands in the way of progress on predicate development. And it's covered more rigorously by ELSE. Hence this removes this aspect of DEFAULT (it still works when the left is a SET-WORD! for defaulting variables).