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
Status : planned Submitted by Steven Taylor on 2/24/2015 12:00:00 AM 1 votes
Note that if the record {a: int; b: int} is declared last, then type + argument name type inference will not work. Switching the order around resolves the issue. However, this behaviour can be a little mentally jarring.
The lightweight syntax is very useful. It'd be great to strengthen it up.
module Eg1 =
type AB = {a: int; b: int}
type A = {a: int}
type B = {b: int}
let a = {a=1}
let b = {b=2}
let ab = {a=1;b=2}
module Eg2 =
type A = {a: int}
type B = {b: int}
type AB = {a: int; b: int} // <- NB. only the order has changed
let a = {a=1} // fail
let b = {b=2} // fail
// note that example 3 resolves the ambiguity with the dot syntax on the first named field, but that's not the point.
module Eg3 =
type A = {a: int}
type B = {b: int}
type AB = {a: int; b: int}
let a = {A.a=1}
let b = {B.b=2}
let ab = {a=1;b=2}
Activity