Dechenjm / crack-language

Automatically exported from code.google.com/p/crack-language
Other
0 stars 0 forks source link

Tuples #128

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently I don't see any way to create anonymous tuples of types.

For example, in many other languages, (1, 'hello', 2.3) would create a tuple of 
type (int, String, double).

There are at least four components to this, to make it useful:

1) Ability to define tuple values: (1, 'hello', 2.3)
2) Ability to denote tuple types: (int, string, double)
3) Tuple assignment: (a, b, c) := (1, 'hello', 2.3);, equivalent to a := 1; b 
:= 'hello'; c := 2.3;. No tuple is actually created, it's just syntactic sugar.
4) Tuple unpacking: d := (1, 'hello', 2.3); (a, b, c) := d;, useful for 
unpacking tuples when returned from a function. This is for the case when a 
tuple is actually created as an object and needs unpacking.

I didn't check whether the above notation for tuples would cause ambiguities in 
crack. Another notation might be required.

Original issue reported on code.google.com by goodwill...@googlemail.com on 28 Dec 2014 at 4:22

GoogleCodeExporter commented 9 years ago
The lack of tuples in their classical form is by design.

I've taken this opportunity to include this in the FeaturesCrackWontHave page:

https://code.google.com/p/crack-language/wiki/FeaturesCrackWontHave?ts=141980640
1&updated=FeaturesCrackWontHave#Tuples_(_)

Original comment by mind...@gmail.com on 28 Dec 2014 at 10:43