Carpet

Carpet

2M Downloads

Shapes.scl broken by new method of adding lists and sets via +=

Ghoulboy78 opened this issue ยท 4 comments

commented

Now list_variable += set will make the set an element of the list, as opposed to previously when it would add all the elements. While this is good in most cases, it screws up. I have a solution for that though, and hear it out.

I propose to add streams, or sequentially generated objects. The way they will work is that you call next(stream) and it will evaluate the next item, and you declare them via stream = stream(_(prevstate)->{'ret'->prevstate:'acc'+1, 'acc' -> prevstate:'acc'+1})
So basically, the prevstate is a map of the previous state, and you can set whatever state you want, holding whatever variables yo want as keys, and then there is a 'ret' element of the map (can be renamed return, whatevs) which means whenever you do like:
x = next(stream), x will be assigned to that ret parameter. This would fix it as then I could sequentially generate the lists and simultaneously add them .

Now after further thought, the above problem can be fixed using x = x + set isntead of +=, but I'm still gonna leave this stream object stuff here, cos I think it's still interesting. I will submit a pr to fix the shapes.scl problem, then make another issue to discuss the stream stuff.

commented

Not sold/not understanding the stream thing, but if behaviour changed between versions without deprecation or anything that still a bug, doesn't matter if it can be fixed (plus I think adding the things from a set makes more sense than adding a set to the end of the list, if I'm understanding this correctly).

Also I don't think that a string with the content of each element of the list with the set at the right is correct...
imagen

IMO this should be 2 issues, the feature request and the bug.

commented

ik it should be, but I hadnt made the pr yet. Ill make the separate issue now

commented

ok added stream issue in #1155

commented

Well gnembon has decided that this is not an issue.