Explicitly test that the empty string is not treated specially in twofer#1802
Conversation
sshine
left a comment
There was a problem hiding this comment.
the empty string should not be treated as a special case like null
I will point out that not treating "" as null can be done either by explicitly treating "" as something else, or as not treating "" at all. The advantage of the test is clarity: The student knows exactly what to expect. The advantage of the absence of the test is flexibility: The student and the mentor don't have to bother with the edge case.
I don't think one of these didactics are ultimately better than the other. I've used both.
In #1783, @Smarticles101 interestingly pointed out that this exact test was added in #733 (and discussed in #728). So the question arises, why was it then removed? The PR that removes it, #1246, doesn't reference the commit that added it, and it doesn't argue either. So I think it would be safe to say that most voices have endorsed the test.
I'm writing all of this to clarify, when someone comes along and wants to remove it again, this serves as a kind of summary of points previously made. And I'm noting to myself that nulls are bad, but that even Haskell has undefined; having the flexibility to choose whether to denote that a function is provably total is something we still only see in languages like Idris and F*.
This is precisely the point. We are trying to teach and giving students (especially in these early exercises) an ambiguous problem is not helpful. |
We decided in issue #1783 (and previously) that the empty string should not be treated as a special case like null. As such, I think we should have a test for it.
Reviewer Resources:
Track Policies