On 6/5/16, Anonymous via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > static Note[0] empty; > > Note[] getNotes(string id) > { > return (id in store) ? store[id] : empty; > }
It's likely an accepts-invalid bug, meaning it should be a compiler error instead. I don't think it makes sense that the compiler tries to slice a fixed-length array of length zero.. tho perhaps it should just equate that to returning null. In any case you can return `null` instead of "empty". Fixed-length arrays of length zero aren't really all that well-defined. Some would say they make no sense, but there is a weird benefit to them when used with the built-in hashmaps (a void[0] value type wouldn't allocate memory, AFAIR and if that is still true).