Changeset 292d6cf6
- Timestamp:
- Oct 30, 2024, 11:05:41 PM (3 weeks ago)
- Branches:
- master
- Children:
- b7921d8
- Parents:
- 520fa9e (diff), 5485bcac (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/proposals/tuples.md
r520fa9e r292d6cf6 240 240 allow restructuring when the type is passed as a type value. This may be 241 241 the most correct form, but seems surprising compared to the common use. 242 243 ### Tuple Arrays Not Supported 244 245 You cannot make an array of tuples. For some reason the type just will not 246 work. Thoretically it could, each tuple type has a size and alignment and 247 could be put in an array. However the following type is not accepted: 248 249 [int, char] array[3] = {{1, 'a'}, {2, 'b'}, {3, 'c'}}; 250 251 Now the opposite, a tuple containing an array, does actually work: 252 253 [int[3], char] data = {{1, 2, 3}, 'd'}; 242 254 243 255 ### Unary Tuple Value Syntax … … 539 551 ([int, int, int])tuple_int_int; 540 552 ([long, [float, int]])tuple_long_float_int; 553 554 ### Tuple Array Support 555 556 Arrays of unstructured tuples/packs are not actually required, an array of 557 structures will store the data just as well and this is not the transient 558 context where the unlabeled tuples work well. So it would work fine to 559 not allow an array of packs, but if we do not a better error should be 560 created. 561 562 All that being said, the following could just work. 563 564 [int, char] u_array[3] = {...}; 565 566 What should definitely work is an array of struct tuple, because that should 567 work where a generic structure could be used. This is also part of why arrays 568 of packs are not needed. 569 570 tuple([int, char]) s_array[3] = {...}; 541 571 542 572 ### New Tuple Literal Syntax
Note: See TracChangeset
for help on using the changeset viewer.