-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
For example in python you can use the * operator like x(*array) which translates to expanding the array as if it was a series of arguments i.e. the following;
arr = [1, 2, 3]
x(arr) # is just x( [1, 2, 3] )
x(*arr) # is x( 1, 2, 3 ) - note how the 'array' is goneSince definitions don't allow multiple arguments due to their nature of being able to be typed i.e.
arr : []int = [1, 2, 3] should we be able to 'not type' them (thus allowing the values to not conform to the type UNTIL they are used in a function call) then later 'unfold' them i.e.
arr := [1, 2, 3, 5.0, true]
A.x = arr // error: not all types are the same
A.x = *arr // perfectly fine is just the same as A.x = 1, 2, 3, 5.0, trueNow the question is also what should the syntax be, I don't particularly like the * as it is too close to the pointer syntax in languages for my liking; I would prefer a more 'slice' based syntax i.e. arr[..]. This would fit the similar syntax of the proposed slices (#11 ).