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

Document that buildArity() must take a sorted list of features #14

Open
kennytm opened this issue Mar 25, 2013 · 1 comment
Open

Document that buildArity() must take a sorted list of features #14

kennytm opened this issue Mar 25, 2013 · 1 comment

Comments

@kennytm
Copy link
Contributor

kennytm commented Mar 25, 2013

Arity::lookupFeature (thus Record::lookupFeature) uses binary search to find a feature. This requires the features to be totally ordered. But buildArity() won't check if the features are sorted. This causes strange "illegal field selection" errors when developers are unaware of such caveat.

I don't think it's possible for buildArity() to sort the features, because it needs to be matched with buildRecord(). But we could at least add some warning in the doc? Or maybe add an is_sorted() check in debug mode.

@sjrd
Copy link
Member

sjrd commented Mar 25, 2013

Ah indeed, buildArity() was designed to receive the features in the correct order. It should certainly at least be documented. Maybe a check in debug mode would be a good idea, too.

carealejo referenced this issue in carealejo/mozart2-vm Apr 22, 2013
Added support for severals Gecode::dom in fd module.
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

2 participants