Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!require has no effect on input width #213

Open
jabowery opened this issue Jul 25, 2016 · 11 comments
Open

!require has no effect on input width #213

jabowery opened this issue Jul 25, 2016 · 11 comments

Comments

@jabowery
Copy link

jabowery commented Jul 25, 2016

Load this with ?log=1 and note #query[width] has a value of 0.

<span id="spanner"></span>  
<input id="query"  type="text" value="" />
<style type="text/gss">
        @h (#spanner)(#query) in(::window) ; 
        #query[width] > 100 !require;
</style>

@hfossli
Copy link

hfossli commented Jul 26, 2016

Isn't this underconstrained? Can't the width be any value above 100?

@jabowery
Copy link
Author

jabowery commented Jul 26, 2016

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.

@hfossli
Copy link

hfossli commented Jul 27, 2016

Would you rather have the value to be 100000000 or 2725152848 or 28171? It won't choose 100 unless you add

#query[width] == 0 !weak

@Inviz
Copy link
Contributor

Inviz commented Jul 28, 2016

Try >= ?

@hfossli
Copy link

hfossli commented Jul 28, 2016

🙌

@jabowery
Copy link
Author

jabowery commented Jul 28, 2016

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

@Inviz
Copy link
Contributor

Inviz commented Jul 29, 2016

your vfl is not bound to edges of the window. in(::window) dows nothing in this case. Use vertical pipes at the boundaries

@jabowery
Copy link
Author

jabowery commented Jul 29, 2016

@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?

@Inviz
Copy link
Contributor

Inviz commented Jul 29, 2016

first two are correct. Make sure you get GSS to know width of your elements (by constraining them or binding them to intrinsic width).

@jabowery
Copy link
Author

jabowery commented Jul 29, 2016

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".

@Inviz
Copy link
Contributor

Inviz commented Jul 30, 2016

> and < do not apply constraints actually, I believe. So try >= and <=. Something like this:

#query[width] <= ::window[width] ;
#query[width] >= 100;
#query[width] == 100 !weak; // which to prefer - smaller or bigger by default
#spanner[width] >= 0; // dont let spanner subtly collapse to negative width

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants