Skip to content

GRSmallDictionary2 removeKey: is not working  #81

Closed

Description

@gcotelli

The following code

GRSmallDictionary2 new
	at: 'x' put: 'x';
	at: 'y' put: 'y';
	at: 'z' put: 'z';
	removeKey: 'z'

produces a subscript out of bounds. Tested in Pharo 7.

This is a simplified example, we hitted this problem in some Seaside code trying to remove some keys from the arguments of a JSObject.

Activity

  1. added a commit that references this issue on Jan 23, 2019
    cf4ec7c
  2. gcotelli commented on Jan 23, 2019

    @gcotelli
    Author

    Changing

    GRSmallDictionary2>>removeIndex: index
    	| value |
    	value := table at: index + 1.
    	index to: size * 2 - 2 do: [ :i | 
    		table at: i put: (table at: i + 2) ].
    	table at: size * 2 - 1 put: nil.
    	table at: size * 2 put: nil.
    	size := size - 1.
    	^ value

    makes it work.

    Here's a test case showing the problem:

  3. gcotelli commented on Jan 23, 2019

    @gcotelli
    Author
    testBugFixIssue81
    
    	| dictionary |
    
    	dictionary := GRSmallDictionary2 new
    		at: 'x' put: 1;
    		at: 'y' put: 2;
    		at: 'z' put: 3;
    		yourself.
    
    	self
    		assert: (dictionary removeKey: 'z') = 3;
    		assert: dictionary size = 2.
    
    	dictionary := GRSmallDictionary2 new
    		at: 'x' put: 1;
    		at: 'y' put: 2;
    		at: 'z' put: 3;
    		yourself.
    
    	self
    		assert: (dictionary removeKey: 'y') = 2;
    		assert: dictionary size = 2
  4. gcotelli commented on Jan 23, 2019

    @gcotelli
    Author

    I was going to produce a PR but noticed that commiting my changes with Iceberg there was a lot of unrelated differences :(

    Some caring soul can commit this changes 🙏 in the right format

  5. gcotelli commented on Jan 23, 2019

    @gcotelli
    Author

    I produced the PR and let you decide what to do.

  6. marianopeck commented on Jan 23, 2019

    @marianopeck

    Weird the problem with Iceberg because the format is clearly specified as filetree: https://github.com/SeasideSt/Grease/blob/master/repository/.properties

  7. jecisc commented on Jan 23, 2019

    @jecisc
    Member

    @marianopeck Since the number of metadata full projects still out there is really low, Iceberg does not manage it. (Too much development time for too few uses)

  8. marianopeck commented on Jan 23, 2019

    @marianopeck

    Hi @jecisc,
    So then how are they (Grease developers) supposed to work with/for Pharo 7? They are force to migrate to Tonel?

  9. jecisc commented on Jan 23, 2019

    @jecisc
    Member

    FileTree is still supported but only in metadata less mode.

    To keep contributing to metadata full projects users needs to keep the same workflow than before Iceberg creation. Add a file tree repository to Monticello, export the code via Monticello in the file system then commit outside Pharo. (That was the way to use git before Pharo 6).

  10. marianopeck commented on Jan 23, 2019

    @marianopeck

    Thanks @jecisc for the explanation. I now understand why @marschall was considering moving to metadataless filetree. I guess at this point is not worth and would be better to move to Tonel, right?

  11. jecisc commented on Jan 23, 2019

    @jecisc
    Member

    @marianopeck It still has advantages to use metadata less filetree.

    Here is some info of what I know we can do with different Pharo versions:

    Pharo < 3

    We can load FT metadata full projects.

    Maybe metadata less project by updating Metacello but I'm not sure.

    Pharo 4/5/6.0

    We can load FT metadata full and metadata less projects.

    We can load tonel project only if we update Metacello then install Tonel munally.

    Pharo 6.1/7/8

    We can load FT metadata full and metadata less projects.
    We can load tonel project out of the box.

    So, if we move to tonel (which I would love to reduce the number of files :D), the users will need to update Metacello and install tonel to load Grease.

  12. jecisc commented on Jan 23, 2019

    @jecisc
    Member
    Version FT full FT less Tonel
    3 V With Metacello update? X
    4 V V With Metacello update + Tonel install
    5 V V With Metacello update + Tonel install
    6.0 V V With Metacello update + Tonel install
    6.1 V V V
    7 V V V
    8 V V V
  13. jecisc commented on Jan 23, 2019

    @jecisc
    Member

    I begun to write a documentation on the code formats:

    pharo-open-documentation/pharo-wiki#72

  14. marianopeck commented on Jan 24, 2019

    @marianopeck

    Wow @jecisc that's a really niece summary of the status! Great work! Based on that wiki page, IF we do the effort of migrating Seaside repos, I would do it for sure to Tonel. I don't care about Pharo 3 ( It was released 5 years ago) and I don't care they have to manually update Metacello + Tonel as long as that is documented and working. If you want, you can say, OK, Seaside 3.4 from now onwards will only work in Pharo > 3 and that's all.
    What I can say, is that contributing right now to Seaside is complicated, because everybody (that contributes) is likely using Iceberg and in 6.1 or 7. This case #81 is the clearest proof of that, right?

  15. self-assigned this
    on Jan 24, 2019
  16. jbrichau commented on Jan 24, 2019

    @jbrichau
    Member

    @jecisc and @marianopeck : Moving Grease to Tonel is not possible before it's supported on Gemstone, Squeak and before there is a clear path for migrating it to repositories for other platforms (VA, VW,...). Grease is intended to be a cross-platform layer, but as far as I know Tonel is just for Pharo.

    @gcotelli I'll see what I can do and comment via the PR if necessary. Thanks.

  17. added a commit that references this issue on Jan 24, 2019
  18. marianopeck commented on Jan 24, 2019

    @marianopeck

    Hi @jbrichau good point about other platforms. It's not only about Pharo. I guess we want both (Seaside and Grease) to continue working in other dialects as they do now. As for VA, we are pushing for Tonel...

    Anyway, do you agree to at least update the Contributing page to explain how to contribute? I must said explicitly that these repos are Metadata full and how you would contribute that way with the different versions of Pharo, right? I am talking about this: https://github.com/SeasideSt/Seaside/blob/master/CONTRIBUTING.md

    Thanks!

  19. jbrichau commented on Jan 24, 2019

    @jbrichau
    Member

    @marianopeck we already settled on metadataless for both repositories. Seaside already is, Grease was half-way (pharo7 package was already metadataless) and as of a few minutes ago, it's metadataless ;)

  20. marianopeck commented on Jan 24, 2019

    @marianopeck

    Hi @jbrichau so that means, based on above wiki, that since Pharo 4 to 8, we can contribute to Seaside using Filetree metadataless but not using Iceberg right? As @gcotelli said Iceberg does not work well enough with filetreee. Is that correct?

  21. jecisc commented on Jan 24, 2019

    @jecisc
    Member

    @marianopeck metadata-less is Iceberg compatible. Only metadata full is not :)

    There is only one bug, it does not commit a full package removal, that's on my TODO list to check. (And it does not happen that often. Also, it keeps the package in the repo but the package would not be loaded)

  22. jbrichau commented on Jan 24, 2019

    @jbrichau
    Member

    thanks @gcotelli for fixing!

  23. marianopeck commented on Jan 25, 2019

    @marianopeck

    HI @jecisc thanks for you explanation. So, based on your comment "metadata-less is Iceberg compatible. Only metadata full is not :)" and based on @jbrichau " Grease was half-way (pharo7 package was already metadataless) and as of a few minutes ago, it's metadataless ;)", then the only explanation of why @gcotelli saw the problem with Iceberg is because at that time he was in the 50% of Grease that was metadata full? That would explain everything :)

  24. jecisc commented on Jan 25, 2019

    @jecisc
    Member

    That's the case I think! :)

  25. added a commit that references this issue on Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions