Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework test-words into "test" namespace #102

Merged
merged 4 commits into from
Oct 11, 2023
Merged

Rework test-words into "test" namespace #102

merged 4 commits into from
Oct 11, 2023

Conversation

glennj
Copy link
Contributor

@glennj glennj commented Sep 29, 2023

Following http://forum.exercism.org/t/pr-for-sieve-exercise/7500/7

This is a mostly-rewritten test-words file (for the sieve exercise).

It's got:

  • a namespace
  • renamed test words
  • more comments
  • "SED:" directive
  • re-organized.

As I mentioned in the forum, the new word names may be too short for newbies.

@glennj glennj marked this pull request as draft September 29, 2023 19:44
@axtens
Copy link
Member

axtens commented Sep 30, 2023

Putting it all in a namespace is a GREAT idea. Ron might even add it to the libs such that we could do needs test or similar.

I do like your naming ... until you get the the names of the actual tests themselves and then it gets all arcane and Perl-ish: m<n>=. The documentation blurb says that it compares maps. So why not test-maps-equal or two-maps-test-equal?. Or, given that it might end up being prefixed by test:, test:two-maps-equal?

I'm expecting Exercism to be around long after I'm dead. It'd be nice for subsequent maintenance programmers not to have to scratch deep furrows in their heads trying to work out what we've done.

@glennj
Copy link
Contributor Author

glennj commented Sep 30, 2023

all arcane and Perl-ish: m<n>=

I am of two minds about this. More verbose names are easier to grok. On the other hand, students are expected to quickly learn words like n:+, nip, etc and the 3rd exercise is something like

: +gigasecond \ d -- d
  1t d:+msec ;

Terseness is built into the language.

All that to say, I could go either way.

@glennj
Copy link
Contributor Author

glennj commented Oct 1, 2023

@softmoth, care to jump in?

@softmoth
Copy link
Contributor

softmoth commented Oct 1, 2023

I think I prefer the brief names. I feel a bit guilty about it, but not too much.

The "test:maps-equal" name isn't sufficiently specific, as it doesn't mention the type of values being compared. Terse names make it less painful to spell out the specific types.

But I like Perl, so my preferences may be biased. 😁

Tim

@axtens
Copy link
Member

axtens commented Oct 1, 2023

I also like Perl. And others like SNOBOL4 and klong (the latter another hyper-terse language).

For argument sake let's see if i can pull @ronaaron and @Caraciola into the discussion, otherwise we'll have to go to the other forum.

@axtens
Copy link
Member

axtens commented Oct 1, 2023

Maybe explain to me what the notation means and I'll be more sympathetic. The < and > aren't saying less than and more than are they?

@axtens
Copy link
Member

axtens commented Oct 1, 2023

Why not variations on map==map??

@ronaaron
Copy link

ronaaron commented Oct 1, 2023

Hello there; I much prefer the discussion be moved to the 8th forum, where a wider audience can give valuable input.

  1. Regarding a 'test' namespace, that's probably a good idea to add to 8th. Please open a discussion on the forum around that. Note: words like "test_start" or whatever would then be more properly "test:start" or, with "with: test" just "start".
  2. It is valuable to do "words/ m:" (etc) to see what words are already available in a namespace. There's a "m:=" already. If you want a comparator word, why not create "m:cmp" similarly to other 'cmp' words?

Best regards,
Ron

@axtens
Copy link
Member

axtens commented Oct 2, 2023

Conversation may continue at https://8th-dev.com/forum/index.php/topic,2745.0.html

@glennj
Copy link
Contributor Author

glennj commented Oct 6, 2023

I feel that we're getting close

@axtens
Copy link
Member

axtens commented Oct 6, 2023

Looking good. I'm still not convinced that a<n>= obviously means anything. That is, that what it means is obvious. By comparison, a:cmp is considerably more obvious once you learn about n:cmp and s:cmp. Perhaps a:cmp! could be used to where the ordering does matter. Then again, I'm doing my own not obvious there. And therein lies my own frustrations with terse programming languages: why can't it say what it means? Maybe COBOL's as bad for the programmer brain as BASIC is supposed to be.

@glennj
Copy link
Contributor Author

glennj commented Oct 6, 2023

I intend to use Ron's utils/test and harness, and the type-agnostic equal? predicate.

@glennj
Copy link
Contributor Author

glennj commented Oct 9, 2023

This latest commit will fail, this change to use the utils/test lib and harness.8th (as demonstrted on the forum) requires changes to the testing instructions

EIGHTLIB=./libs 8th -f harness.8th

or instructions to the student to copy the ./libs/utils/test file to their 8th installation (or provide the test lib to them in the installation instructions).

This will be a large change to the track. I'd appreciate comments.

The equal? word is particularly cool, IMO.

@axtens
Copy link
Member

axtens commented Oct 10, 2023

Yes I like the equals? as well.

It is a large change but it brings us into line with what the vendor uses. And we're wanting people to take the skills they learn on Exercism into the outside world, so using vendor tools makes for a better outcome long-term.

@glennj
Copy link
Contributor Author

glennj commented Oct 10, 2023

I am having second thoughts about it though. How long will it take for utils/test to be added into the 8th release zipfile? What to do for users who already have 8th installed, do we tell them "add this file to your 8th distribution"

Also, if we distribute "utils/test" with the exercise, we have to tell people to set the EIGHTLIB environment variable for Windows and Mac and Linux.

I'm circling back to our test_words.8th file, but with simplified testing words:

  • test:true?
  • test:false?
  • test:null?
  • test:equal?

I like our test case output, colourized, with a summary of passed-skipped-failed

@axtens
Copy link
Member

axtens commented Oct 11, 2023

The simplified test words look good. Given the present unknowns, and the time-cost of the changes, I'm happy for you to go ahead on the course you've just outlined.

@axtens
Copy link
Member

axtens commented Oct 11, 2023

Looking back at your other questions:

  1. Ron's churning out updates to the distributed code and libs approximately monthly. Current events in Israel may impact that.
  2. I download the zipfile not quite as regularly, zipcloak it, and then send it on to @ErikSchierboom with the password.
  3. Once the zipfile is in place the UX users have the most recent
  4. For CLI users, they should be requesting the update when it drops and installing it
  5. If a library file is in libs then it should be found by the interpreter without recourse to environment variables

@glennj
Copy link
Contributor Author

glennj commented Oct 11, 2023

  1. For CLI users, they should be requesting the update when it drops and installing it

Hmm, you have a high opinion of CLI users. I'm generally more of a "get it and forget it" guy, unless a package manager util tells me there's a new version available.

  1. If a library file is in libs then it should be found by the interpreter without recourse to environment variables

That's not my experience: 25.1 8th libraries, include files, and your code

  • needs uses the 8th installation libs dir, else the EIGHTHLIB env var
  • f:include looks in the incs dir if the file included is not in the current dir.

@glennj
Copy link
Contributor Author

glennj commented Oct 11, 2023

@axtens @softmoth I think I've pounded it into a shape I'm content with. Let me know if I've chiseled away too much.

Main takeaways

  • test.8th now includes the actual tests, removing one file
  • test-words.8th is moved to libs/exercism/test
  • the test words are namespaced, and brought into the word lookup chain with with: test
  • equal? should work with numbers, strings, arrays and maps
  • true? false? null? are also available.
  • Thus far, I've only tested with the sieve exercise, comparing arrays of numbers.

@glennj
Copy link
Contributor Author

glennj commented Oct 11, 2023

image

image

@axtens
Copy link
Member

axtens commented Oct 11, 2023

Regarding needs, don't forget what https://8th-dev.com/words.html says about it

@glennj
Copy link
Contributor Author

glennj commented Oct 11, 2023

I swear, that wasn't working earlier...

@glennj glennj marked this pull request as ready for review October 11, 2023 12:12
@softmoth
Copy link
Contributor

I think I've pounded it into a shape I'm content with. Let me know if I've chiseled away too much.

It looks great. That test:eq? resolves the explosion of names we were trying to manage with a cryptic meta-syntax, without having to resort to, say, converting everything to JSON and doing string comparisons or some other nasty kludge. It can be expanded if needed to handle more kinds of values. And the end result is very clean. I like it!

@glennj glennj merged commit 910cd21 into main Oct 11, 2023
2 checks passed
@glennj glennj deleted the test-words branch October 11, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants