Better type inference for slice()