How to add a Feature in Julia Lang

I would like to use Sets like this:

julia> Set(1,2,3)
Set{Int64} with 3 elements:

I want to add one overload.

julia> Set(args::T...) where T = Set(args)
julia> Set(args::Any...) = Set(args)

How would I propose that (on Github)?

This is actually how sets used to work, if I remember right. The problem — and the reason why it was deprecated — is that it introduces a confusion between what Set(1:2) means: is it what it’d mean if it were a part of Set(1:2, 3:4)? Is it the set with a single 1:2 element or is it the Set with a 1 and a 2?


First search the github issue tracker for related issue or discussions about something related to your proposal. This is vital so that you don’t waste your time, or the time of the julia devs. I’ve been guilty a few times now of proposing something only to find out that there was already several old discussions that I missed previously.

The second step is to open an issue to propose and discuss your change (this is not strictly necessary, but is often a good idea so you don’t waste effort making something that is unacceptable)

Once the idea has been discussed, you then fork the julia repo on github

See the fork button on the top right? Click that. Next, you make the changes you want to propose in your forked copy of the julia repo, and then you will see a bar in your copy

that says ‘pull request’. Click that, and it will allow you to open what’s called a pull request to the julia repo and then people can discuss your specific implementation of the proposed idea.

Finally, it’s important to be humble and understanding when people criticize your proposal. I like to think I’m pretty good at receiving criticism, but sometimes, when I work on something that I think is cool or clever, it’s really hard to hear someone you respect say that it is a bad idea or that they disagree with it. It’s important to remember that Julia is a language used by many different people and they all have deep stakes in it, so proposals must go through rigorous discussion before they’re accepted. The people reviewing these proposals are often very knowledgeable, and see many proposals every day. We all have to do our best to not take it personally when our ideas don’t work out.


In other words, it’s really valuable to do a bit of searching to see if it’s been proposed before and if there have been any prior discussions or decisions before investing to much energy into the idea. :slight_smile:


You might want to check out @kslimes’s awesome tutorial on how to start contributing to Julia:


Ahh, didn’t think of that. That’s actually a good point


Here you go:


One thing you can do is define your own factory function, e.g.

julia> set(args...) = Set(args)
set (generic function with 1 method)

julia> set(1,2,3)
Set{Int64} with 3 elements:

This way, the Set constructor is unchanged and there’s no ambiguity with it, but you can also have the constructor you want. This is a rather common pattern that ends up being needed. For instance Tuple versus tuple:

julia> Tuple(1,2,3)
ERROR: MethodError: no method matching Tuple(::Int64, ::Int64, ::Int64)
Closest candidates are:
  Tuple(::Any) where T<:Tuple at tuple.jl:230
 [1] top-level scope at REPL[6]:1

julia> tuple(1,2,3)
(1, 2, 3)


julia> Tuple((1,2,3))
(1, 2, 3)

julia> tuple((1,2,3))
((1, 2, 3),)