Missing code in community solutions

Hey, I just submitted a working solution for the Dice exercise and noticed that the submission tools did not pick up any changes I made to the SmallInteger class, so a big part of my solution is missing when you look at it on the website.

I looked at other solutions and this seems to be happening to others as well. The d10 and d20 methods are nowhere to be seen.

I am wondering if this is because I did something wrong. Is there some language concept of adding methods to integers only in the context of the exercism package? It seems a bit silly that now I have these vestigial d10 and d20 methods for SmallInteger on my image.

If I understand correctly, you’re working locally and used the exercism submit command to push your code? Further, it sounds like you edited multiple files? If you run exercism submit without any other arguments, the tool only submits the “expected” solution files. If you are working across multiple files, you can submit them by specifying them explicitly: exercism submit Die.class.st Other.class.st More.class.st.

Did I understand correctly? Does that help?

I submit directly from Pharo – right-click on the exercise package, then select Exercism → Submit exercise. I have no idea about working with individual files. I wouldn’t even know how to export my SmallInteger class to a text file and even then, I’d be afraid that submitting it via CLI would send the whole thing instead of just my added methods.

Exercism doesn’t maintain anything that supports right clicking :slight_smile: That sounds like some IDE with some Exercism extension. It sounds like that extension is a wrapper that just runs the exercism submit command.

When you submit a solution to Exercism, it uploads file(s). I’m not sure what “the whole thing” is vs “just my added methods” but the API works at a file level.

I use the process that Exercism itself says to use.

Okay. That workflow only supports uploading the expected solution file and will not pick up any additional files you may edit. If you’d like to spread your solution across additional files, you’ll need to specify the files with the exercism submit command.

1 Like

@IsaacG The Pharo track is special. All users work in a Pharo-specific GUI environment, so the exercism CLI does not apply.

@factor3 If you want to add methods to builtin classes, you have to mark that they are extensions located in your namespace.

Here’s an example where I added a negateThisNumber method to SmallInteger:

Click the “extension” checkbox that I circled. Select your “Exercism@SomeExercise” package and click OK.

In my image, I extended SmallInteger into my Hamming solution, and now the package looks like this in the browser: SmallInteger is a class in my solution

I used this technique for my collatz-conjecture solution. It looks like this, a file with an *.extension.st filename.

4 Likes

Seems that information would be useful for other students as well. Maybe the maintainers can add it to the track docs.

@glennj can you make a comment in the source to link to this forum post, or in the community solutions comment area, maybe?

It looks like it would be good for mentor information as well.