https://kotlinlang.org logo
#kotest
Title
# kotest
d

dave08

05/23/2021, 12:41 PM
Another little point... it's a bit confusing to have the CodePoints in the same
Arb
as the actual arbitraries... maybe they should be in a
CodePoint
companion object?
s

sam

05/23/2021, 12:45 PM
you mean Arb.Codepoints.foo ?
d

dave08

05/23/2021, 12:46 PM
No, just Codepoint.foo... the Arb would just make the line longer...
s

sam

05/23/2021, 12:47 PM
so just a top level object
All arbs are currently defined on Arb, for easy discoverability
d

dave08

05/23/2021, 12:50 PM
My point is that they usually are used in combination with Arb.string(..., CodePoint.XXX), although they are Arbs themselves, I wonder if anyone uses them as such. So they could have their own "namespace" to indicate what is available to Arb.string, and they won't interfere with the real Arbs.
s

sam

05/23/2021, 12:51 PM
I see your point, perhaps typealiases ?
d

dave08

05/23/2021, 12:51 PM
My concern is code complete...
s

sam

05/23/2021, 12:52 PM
you want to de-clutter code complete ?
d

dave08

05/23/2021, 12:53 PM
Yeah, and make it clearer what options are available in the two contexts. I don't think a typealias would help, but I guess that deprecated CodePoints on Arb would help migrating and I'd suppose the IDE is smart enough to deprioritize deprecated things.
s

sam

05/23/2021, 12:54 PM
You're probably right that they're never used outside of strings.
If you want to move them to a new top level object, and put in deprecated typealiases for backwards compatbility then I would merge that PR
👍🏼 1
d

dave08

05/23/2021, 12:59 PM
Maybe adding a companion object to CodePoint itself?
And then making them extension functions off it?
s

sam

05/23/2021, 1:00 PM
Yes that seems like a good approach.
d

dave08

05/23/2021, 1:33 PM
It doesn't seem that a typealias can be made as an extension function off Arb.Companion?
I think I might have to leave the original functions as deprecated to delegate to the new ones.
s

sam

05/23/2021, 1:34 PM
Ah ok well that works yeah
d

dave08

05/23/2021, 1:35 PM
In the meantime, I might as well also replace the deprecated Char.toInt() with Char.code?
(in codepoint.kt, I mean)
s

sam

05/23/2021, 1:35 PM
Only if its not 1.5 only
d

dave08

05/23/2021, 1:36 PM
Oh, you're not using any 1.5 in the newer versions? I guess I'll leave them then.
s

sam

05/23/2021, 1:38 PM
Its compiled against 1.5
But we don't want to force users off 1.4
Saying that actually 5.0 will be 1.5 only
So yeah change it
👍🏼 1
d

dave08

05/23/2021, 2:30 PM
Funny, I tried running StringArbTest, but the IDE couldn't find
a.codePoints()
?
But the tests passed, so I guess it's a cache problem.
I should do the PR against the master branch?
s

sam

05/23/2021, 2:51 PM
Yes
s

sam

05/23/2021, 2:59 PM
looks good
8 Views