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 didn't see an opened issue for this, considering this issue has been reported by the compiler itself for a long time, and I'm not the only one who meet this issue, I created a new issue.
The text was updated successfully, but these errors were encountered:
I'm curious as to when you would ever need to do this; there are so many alternative ways to handle this that it makes me question if this should be implemented at all.
the obvious one: avoid creating an union; either by always merging, or with a distinct double splat in each branch of a condition;
foo(**args.merge(checked: rand(0..2) ==0))
if rand(0..2) ==0
foo(**args.merge(checked:true))
else
foo(**args)
end
add a method overload that takes a NamedTuple:
deffoo(**args)
foo(args)
enddeffoo(args : NamedTuple)
p args
endif rand(0..2) ==0
args = args.merge(checked:true))
end
foo(args)
I believe libraries should always provide an overload to accept a NamedTuple directly. The point is to spare an expensive Hash when args are known at compile-time. Double splats are mostly sugar coat: they hide a merge (for example foo(**args, checked: true) reads much better than foo(args.merge(checked: true)) and allow intermediary methods to anonymously pass args around.
Bug Report
Both of following code give same error message
The very detailed discussion, check here
I didn't see an opened issue for this, considering this issue has been reported by the compiler itself for a long time, and I'm not the only one who meet this issue, I created a new issue.
The text was updated successfully, but these errors were encountered: