let create base ~pos ~len =
if pos < 0 then
failwithf "Substring.create got negative pos %d" pos ()
else if len < 0 then
failwithf "Substring.create got negative len %d" len ()
else if pos + len > Base.length base then
failwithf "Substring.create went past end of buffer %d"
(pos + len) ()
else
{ base = base; pos = pos; len = len; }