From: Andreas Launila Date: 2007-06-07T23:35:11+09:00 Subject: Re: Gecode/R - Request for syntax feedback James Edward Gray II wrote: > On Jun 7, 2007, at 9:10 AM, Andreas Launila wrote: > >> James Edward Gray II wrote: >>> On Jun 6, 2007, at 5:21 AM, Andreas Launila wrote: >>>> Another variation would be to use a combination of constrain and >>>> RSpec's >>>> should/should_not. >>>> >>>> constrain (x + y).must == z >>>> constrain (x + y).must_not == z >>> >>> That's not too bad. I think my biggest complaint there is that it makes >>> the flow of the line a little hard to follow. Perhaps must/must_not >>> could replace constrain altogether though: >>> >>> must x + y == z >>> must_not x + y == z >>> >>> That doesn't read too well though, does it? >>> >> >> I think that must/must_not would make a fairly interesting syntax in the >> sense that it reads very well. Therefore I have tried some examples at >> http://gecoder.lokorin.org/dev/wiki/Syntax_test#must.2Fmust_not . >> >> They probably require skipping "constrain" though and replacing it with >> something block-like, it just doesn't read right otherwise. > > I like how this reads in the early examples and worry about that amount > of core hacking we have to do to support the later examples: > > whatever.with_offsets ... > whatever.sorted ... > whatever.sorted_with ... > whatever.occurrences_of ... > whatever.any ... > whatever.all ... > whatever.implies ... > whatever.equivalent_to ... > Unless the enumerables are wrapped before use as in the other example (or the variables are sent through as parameters alongs with the block as in some earlier example). -- Andreas Launila