GemTalk / Rowan

a new project/package manager for Smalltalk that supports FileTree and Tonel repositories, and is independent of Monticello and Metacello
MIT License
14 stars 7 forks source link

(v3) introduce conditional expressions in condition field for components #915

Open dalehenrich opened 8 months ago

dalehenrich commented 8 months ago

From @kurtkilpela:

I had a thought about components. I think we 
ought to allow boolean expressions for conditions. It would be 
convenient if I could write things like `(common or core) and test`. 
This is reasonable to read and allows more complex expressions without 
significantly more mental thought required, for instance `(common or 
(core and extras)) and test`.
I believe it is possible to do this using the and/or methods that would currently work 
in Rowan (multiple conditions in an array for 'and' and multiple nested 
components for 'or'). I just don't like the duplicate files I would have
 to generate as a result (in order to be able to 'or' conditions). For 
Zodiac, I would end up with 7 different nested conditional components in
 order to load 'Zodiac-GemStone-Core'.
(For this particular case, I could definitely generate a condition like 
`gs3.[3-9]` but that isn't a general solution to the problem. In 
general, metacello conditions are 'or'-based. It does cause an explosion
 in component specs to deal with, without a reasonable 'or' in Rowan.)
I also considered the idea of nesting arrays for 'or'. For example:
#condition : 'common' -> if common is set, load me
#condition : ['common', 'core'] -> if command and core are set, load me
#condition : [['common', 'core'], 'test] -> if ((common or core) and test), load me
I don't like this because the logical meaning changes from 'and' to 'or' 
based only on nesting. Additionally, what should happen if someone 
nested arrays deeper? Should those be 'and' or 'or' or something else? 
It isn't obvious just from reading, you need additional knowledge that 
isn't locally present.

I agree ...