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
I just discovered that intV's are allowed as labels to records. So I can write
> {0=0, 1=1}
(0,1)
However doing anything else than exactly creating a tuple, e.g. {1=0, 0=1} or {10=1, x=0} makes things break; generic functions over these objects seem to fail, and :t {10=1, x=0} is reported as (int * )
Is there some reason for this construction? As it stands it can only see it introducing a difficult to track down bug.
The text was updated successfully, but these errors were encountered:
I think that the only reason that this is allowed is because both field projection and construction go through the recfieldname grammar term. Tuple indexing looks like p.3 because tuples can have any size and the Haskell naming convention of fst, snd, thd doesn't scale (what's the name for the 9,237th tuple field?).
Maybe the right way to do this is to validate record construction (rejecting constructions like {1=e, 0=e}).
As you probably guessed, the runtime memory layout of tuples and records is the same, so we settled on using records as the canonical form because that way we don't lose field names.
I just discovered that intV's are allowed as labels to records. So I can write
However doing anything else than exactly creating a tuple, e.g.
{1=0, 0=1}
or{10=1, x=0}
makes things break; generic functions over these objects seem to fail, and:t {10=1, x=0}
is reported as(int * )
Is there some reason for this construction? As it stands it can only see it introducing a difficult to track down bug.
The text was updated successfully, but these errors were encountered: