You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The casting to a pair results in strange values in some cases:
the type of the key is always casted to unknown:
pair<int,int> p <- pair(1::2);
write sample(pair(p));
results in pair<unknown, int>(p) -: 1::2 while the type is explicitly defined for p.
casting a list of pair creates a pair where the key is a list of keys and the value is zero:
write sample(pair([1::2, 3::4]));
result in pair<unknown, int>( [1::2,3::4] ) -: [1,3]::0. Either returning the first item or setting the value as the list of all values would make way more sense.
casting a point into a pair returns a pair where the key is the point and the value is zero:
write sample(pair(point(1,2,3)));
returns pair<unknown, float>(point(1,2,3)) -: {1.0,2.0,3.0}::0.0, I understand why but it goes against the general casting behaviour for pair when there's no obvious cast which is to take the object and make it the key AND value. We could also decide that casting a point to a pair is just reducing dimensionality and thus pair(point(x,y,z)) => x::y
casting a list of one item returns a pair where the key and the value are the only element of the said list, but if there are three or more elements and the type is int or bool then the key is the whole list and the value is 0 or true:
It is not coherent and as the previous point it goes against the general behaviour of casting into a pair when there's no obvious way of doing so.
casting a list of string into a pair gives a key which is the list and a value which is a string containing the list:
write sample(pair(["1","2","3"]));
returns pair<unknown, string>(['1','2','3']) -: ['1','2','3']::'[\'1\',\'2\',\'3\']', I think there's really nobody expecting this from the original cast.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
I've answered most of the issues in the latest commit. Casting is now always following the same rules except for map (list of keys::list of values) and pair obviously.
Describe the bug
The casting to a pair results in strange values in some cases:
results in
pair<unknown, int>(p) -: 1::2
while the type is explicitly defined for p.result in
pair<unknown, int>( [1::2,3::4] ) -: [1,3]::0
. Either returning the first item or setting the value as the list of all values would make way more sense.returns
pair<unknown, float>(point(1,2,3)) -: {1.0,2.0,3.0}::0.0
, I understand why but it goes against the general casting behaviour for pair when there's no obvious cast which is to take the object and make it the key AND value. We could also decide that casting a point to a pair is just reducing dimensionality and thus pair(point(x,y,z)) => x::y0
ortrue
:returns:
It is not coherent and as the previous point it goes against the general behaviour of casting into a pair when there's no obvious way of doing so.
returns
pair<unknown, string>(['1','2','3']) -: ['1','2','3']::'[\'1\',\'2\',\'3\']'
, I think there's really nobody expecting this from the original cast.Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: