On 12-03-23 06:47 PM, Sebastian Sylvan wrote:
> On Fri, Mar 23, 2012 at 1:42 PM, Graydon Hoare <[email protected]> wrote:
>>     - [1,2,3,4,5]    -- constant memory, type [int]
>>     - [1,2,3,4,5]/5  -- constant memory, type [int/5]
> 
> Hmm, why couldn't literals always be fixed-size? They get
> auto-promoted to slices when needed, right? That would remove the need
> for the /X part of the literal syntax at least.

Compare:

  let x = [1,2,3,4,5];   // x:[int], 5 words storage, 2 words for x
  let y = x;             // y:[int], 2 words for y
                         // total: 9 words, 1 array

vs.

  let x = [1,2,3,4,5]/5; // x:[int/5], 5 words for x
  let y = x;             // y:[int/5], 5 words for y
                         // total: 10 words, 2 arrays

-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to