On 07Aug2020 2133, Joao S. O. Bueno wrote:
Enough cheaptalk - links are here:
tests: https://github.com/jsbueno/terminedia/blob/fa5ac012a7b93a2abe26ff6ca41dbd5f5...
Branch comparison for the match/case version: https://github.com/jsbueno/terminedia/compare/patma
I haven't been following this thread too closely, but that looks pretty nice to me. Not obvious enough for me to write my own just from reading an example, and I'd hesitate before trying to modify it at all, but I can at least read the pre- and post-conditions more easily than in the original.
(all said, I think I still miss a way to mark variables that are assigned in the case clauses, just for the record :-) )
Yeah, the implicit variable assignments seem like the most confusing bit (based solely on looking at just one example). I think I'd be happy enough just knowing that "kw" matches the pattern, and then manually extracting individual values from it. (But I guess for that we'd only need a fancy "if_match(kw, 'expression')" function... hmm...) Cheers, Steve