Open jabowery opened 8 years ago
Isn't this underconstrained? Can't the width be any value above 100?
Yes. However it ends up being 0 which is below 100.
I deliberately minimized the amount of code for the bug report. The original code is "under" constrained only in the sense that virtually all constraint programming is under-constrained precisely so it can be adaptive.
Would you rather have the value to be 100000000 or 2725152848 or 28171? It won't choose 100 unless you add
Try >= ?
🙌
I revised the bug report to include in(::window)
(which was in the original code that I simplified for the bug report). Perhaps this will avoid the confusion over the notion of "underconstrained".
Note that this does provide the engine with an upper bounds on #query[width]
when ::window[left] == #spanner[right] == #query[left] == 0
your vfl is not bound to edges of the window. in(::window) dows nothing in this case. Use vertical pipes at the boundaries
@h (#spanner)(#query)| in(::window);
didn't work.
@h |(#spanner)(#query)| in(::window);
didn't work.
@h |(#spanner)(#query)|;
didn't work.
@h (#spanner)(#query) in(::window)|;
kind of worked except it disabled the ?log=1
URL debugging argument.
I saw nothing in the vfl documentation permitting the last syntax that (kind of) worked.
Am I looking in the wrong place for vfl syntax?
Does the absence of debugging despite the presence of ?log=1
rise to the level of a bug?
first two are correct. Make sure you get GSS to know width of your elements (by constraining them or binding them to intrinsic width).
Thanks for clarifying your suggested work around. However, prior to filing this bug report, I had already found a number of workarounds.
Even your workaround is inadequate (or is still insufficiently clear). For example, the phrase "know the width" is either inconsistent with constraint programming (permitting a range of values doesn't specify the value and is the entire point of constraint programming) or, if "know" means "know both the upper and lower bound", this should work with or without the vertical bar and/or the in(::window)
:
@h (#spanner)(#query)| in(::window);
#query[width] > 100 !require;
#query[width] < ::window[width];
A glossary is needed in the GSS documentation. "Determined" (or the more pedantic "critically constrained") clearly denotes constraint to a single value. "Underconstrained" apparently means something other than "unconstrained on at least one of the two bounds". "Adequately Constrained" is unclear since it doesn't mean "known upper and lower bounds". Moreover, the normal use case for constraint programming, which is "Adequately Constrained", whatever that means, with upper bound > lower bound, apparently has no technical term at all -- unless one uses the awkward phrase "adequately constrained but not determined".
>
and <
do not apply constraints actually, I believe. So try >=
and <=
. Something like this:
Load this with
?log=1
and note#query[width]
has a value of 0.