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
where model.Resources() returns a map[int]Resource. The upper code only works, if the map is really an array, so the key's in the map are identically to the list of 0..len(r.model.Resources()).
Suppose you have a map like:
{
10 : ressource1,
20 : ressource2
}
if you use the upper loop, you will loop from 0..1 and use these two numbers as keys in the map, but this won't work, as the keys in the map in this example are 10 and 20.
you should either use a return type of []Resource for the model.Resource() function or use the range keyword to iterate over the map and get the correct keys. i think the current code is semantically incorrect.
yeah, you are creating the model's with consecutive numbers, but this is an implemetation issue, which is not guaranteed by the signature of the type. and it is very strange if you want to understand the code, to see constructs like this :-)
The text was updated successfully, but these errors were encountered:
hi,
in the code of the
AtomicReconciler
you can see the pattern:where
model.Resources()
returns amap[int]Resource
. The upper code only works, if the map is really an array, so the key's in the map are identically to the list of0..len(r.model.Resources())
.Suppose you have a map like:
if you use the upper loop, you will loop from 0..1 and use these two numbers as keys in the map, but this won't work, as the keys in the map in this example are 10 and 20.
you should either use a return type of
[]Resource
for themodel.Resource()
function or use therange
keyword to iterate over the map and get the correct keys. i think the current code is semantically incorrect.yeah, you are creating the model's with consecutive numbers, but this is an implemetation issue, which is not guaranteed by the signature of the type. and it is very strange if you want to understand the code, to see constructs like this :-)
The text was updated successfully, but these errors were encountered: