Splitting more things out of base

I’m going to make the very unhelpful comment that I’m still sore about moving LinearAlgebra out. That said, if LinearAlgebra is out then the stats stuff definitely should be as well, so I definitely concur with that. The special functions should stay in though. Is gamma really that much less deserving of being in Base than sin?

1 Like

“Types that aren’t so good” can be fixed in many ways that aren’t breaking. They can be made thread-safe, faster, etc. “This should be moved out of Base because it isn’t thread-safe” is a weird argument—why not just fix the thread safety issue?

You can do import StrRegex: @r_str to change r"" syntax to another type of Regex.

Also, shouldn’t it be possible to match a Regex with something from Strs as long as the encoding is supported? All you need is a pointer and size.

Absolutely :slight_smile:

lol, well, when you put it that way, it’s just hard to give a rebuttal.

Just please, for the love of god, please don’t take out the hyperbolic trig functions.

@jeff.bezanson Sorry for sounding too agitated.

No, having a global namespace for regex, lgamma, quintile, etc is not a huge catastrophe for me. The two parts I’m thinking about are (1) global identifiers like match name-clashing with unrelated code and (2) API discoverability and organization of documentation that mirrors the namespaces.

When reading code, it is super helpful to see from the imports at a glance which parts of documentation / context to look at. Current Base is large enough that I suspect many people are not aware of its entire namespace / exports (I’m not!), and I don’t like this state of affairs. Then it is of course a matter of coding style whether to go for import and fully qualified names or using.

I am not using julia for embedded development, so I cannot comment on which binary dependencies are a problem or not. I’m not @ScottPJones, so I won’t name-clash with Regex or r_str, but I do name-clash with match (graph theoretical matching). And I use Regex rarely enough that my code would become more readable to me if I used Regex.match instead of unqualified match (because this makes the context clear).

The real problem was the API, that they depend on a global value, and that people have had to play tricks that violate the idea of numbers being immutable in order to achieve adequate performance because of that API.
That is something that cannot be changed in a non-breaking fashion.

Why are you sore about moving LinearAlgebra out?

That is, what is the problem of using LinearAlgebra or using SpecialFunctions? I know that I rarely use the special functions, and if I do then SpecialFunctions.gamma would be a better name than gamma in such contexts: gamma invokes connotations with so many parameters that are also called gamma in the literature, same for beta which is a very natural name for parameters for unicode-haters. Prepending the module name makes the context abundantly clear and is much more readable when the special function is invoked at very few positions in the code. Same for svd: LinearAlgebra.svd is instantly clear; code that is not actually about linear algebra, but only uses linear algebra at some few points becomes so much more readable when the mental context-switch is explicit.

2 Likes

Take a look at what I had to do in StrRegex.jl to support different encodings and code unit sizes.
Regex simply is not designed to handle all the different cases, you basically have to use the String type.
RegexStr would be pretty much a drop in replacement, and does handle those issues.

1 Like