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
A well implemented ordered dictionary would be very nice to have. dict would behave just like map, but dict.keys() would iterate over keys in the order that they were originally inserted. If a key was removed and then reinserted, then it's new position would be last. If a key's value was just updated, then it's position would remain.
To reproduce it would be kind of tricky. Basically I had a class
class Layer : Module(?) {
var subModules: dict(int,owned Module(?));
procinit(in subs:owned Module(?)) {
// want to convert to dict and transfer ownership
}
}
and wanted to instantiate it via
var l =new Layer(new Module1(), new Module2());
but I was running into so many issues. The best solution was just to use shared as the convention for the ChAI library. I did not like the option of using nillable owned:
Summary of Feature
Description:
A well implemented ordered dictionary would be very nice to have.
dict
would behave just likemap
, butdict.keys()
would iterate over keys in the order that they were originally inserted. If a key was removed and then reinserted, then it's new position would be last. If a key's value was just updated, then it's position would remain.I have tried to implement this, but have had issues using it, especially when the value type is an
owned class
: https://github.com/Iainmon/ChAI/blob/main/lib/OrderedDict.chplIs this issue currently blocking your progress?
Yes.
The text was updated successfully, but these errors were encountered: