griffiths-hugh-git / declarative-knitting

A project to build knitting patterns using a declarative, fluent API.
Apache License 2.0
2 stars 0 forks source link

Implement "base" and "modifier" Rules #8

Open griffiths-hugh-git opened 6 years ago

griffiths-hugh-git commented 6 years ago

Currently all rules are considered equal, and avoiding unpicking shaping stitches is the client's responsibility. Implement a concept of a "base" rule which can be used as a fallback. A base rule should have no shaping (e.g. stocking stitch), and if a shaping stitch is unpicked, it reverts to these stitches. This should make it possible to overlay shaping Rules on each other without causing runtime errors. Each row should have exactly one base rule.

griffiths-hugh-git commented 6 years ago

Add a concept of "default technique" to a row - any stitches without an explicit instruction should use this technique (which should be 1-1). A "base" rule should set this default, and contain no other instructions. Then remove the "next stitch" method - all rules should work exclusively by replacements.