The latter; the function returns the index of a fresh new piping hot ds_map, you don't need to assign it to an existing one. And if you did, that would probably take place inside the function (as in, for example, ds_map_copy() ), not by altering a variable that already points to a different map's index.