docs: function range() {
    var args = mlutil.asArray.apply(null, arguments);
  
    var index = null;
    var datatype = null;
    var collation = null;
    var fragmentScope = null;
    var rangeOptions = null;
    var values = null;
    var operator = null;
    var suggestOptions = null;
    var constraintName = null;
    var defaultConstraint = null;
    var arg = null;
    for (var i=0; i < args.length; i++) {
      arg = args[i];
      if (i === 0) {
        index = asIndex(arg);
        continue;
      }
      if (datatype === null && arg instanceof DatatypeDef) {
        datatype  = arg.datatype;
        collation = arg.collation;
        continue;
      }
      if (fragmentScope === null && arg instanceof FragmentScopeDef) {
        fragmentScope = arg['fragment-scope'];
        continue;
      }
      if (rangeOptions === null && arg instanceof RangeOptionsDef) {
        rangeOptions = arg['range-option'];
        continue;
      }
      if (suggestOptions === null && arg instanceof SuggestOptionsDef) {
        suggestOptions = arg['suggest-option'];
        continue;
      }
      if (constraintName === null && arg instanceof BindDef) {
        constraintName = arg.constraintName;
        continue;
      }
      if (defaultConstraint === null && arg instanceof BindDefaultDef) {
        defaultConstraint = arg.defaultConstraint;
        continue;
      }
      if (arg instanceof Array){
        if (values === null) {
          values = arg;
        } else {
          Array.prototype.push.apply(values, arg);
        }
        continue;
      }
      if ((datatype === null || operator === null) && (typeof arg === 'string' || arg instanceof String)) {
        var testType = (datatype === null) ? datatypes[arg.trim()] : null;
        if (testType != null) {
          datatype = testType;
        } else {
          var testComp = (operator === null) ? comparisons[arg.trim()] : null;
          if (testComp != null) {
            operator = testComp;
          } else if (values === null) {
            values = [arg];
          } else {
            values.push(arg);
          }
        }
        continue;
      }
      if (values === null) {
        values = [arg];
      } else {
        values.push(arg);
      }
    }
  
    var rangeDef = new RangeDef(
        index, datatype, collation, operator, values, rangeOptions, fragmentScope
    );
  
    if (values !== null) {
      if ((constraintName != null) || defaultConstraint === true) {
        throw new Error('range has both query and binding: '+mlutil.identify(args, true));
      }
      if (suggestOptions != null) {
        throw new Error('range has both query and suggest options: '+mlutil.identify(args, true));
      }
  
      return new RangeQueryDef(rangeDef);
    }
  
    if ((constraintName == null) && defaultConstraint !== true) {
      constraintName = defaultConstraintName(index);
      if (constraintName == null) {
        throw new Error('could not default constraint name from '+
            Object.keys(index).join(', ') + ' index'
            );
      }
    }
  
    var constraint = new RangeConstraintDef(constraintName, rangeDef, suggestOptions);
  
    return (defaultConstraint !== true) ?
        constraint : new DefaultConstraintDef(constraint);
  }