List of most desired features for Julia v1.x

I want to add a my personal list of desired features. I don’t restrict to 1.0, maybe some are 2.0+.
Most ideas were evoked by the arguments in discourse #5278 and the links therein.

  • Type system
    Keep the type system simple and elegant as it is now. Types and inheritance should remain the only relevant inputs for method dispatching.
  1. Abstract types (stateless, no instances) and concrete types (structs) (optionally statefull, instanciable) shall be the only “type-like” constructs of the language. Other related features (known as traits, interfaces, protocols,…) could be added as optional properties to the types. I will go into details later.
  2. Allow method signatures. That could be parametric subtypes of Function. e.g. Function{Int, AbstractVector{T}} where T.... Used for dispatching: function f(g::Function{Int}) .... The signature does (not) include function name?
  3. Interfaces/protocols
    Optionally add method signatures as members of abstract type and struct.
    Syntax e.g. struct S ... fname::Function{Int} end.
    Semantics: check after end of compilation the existence of specified methods.
    Warnings, if missing methods (signature including name).
  4. Abstract multiple inheritance.
    Syntax e.g. struct N <:A<:B ... or abstract type N <:A::B::C … where A,B,C are already defined types.
    Semantics: For the purpose of dispatching replace chain of supertypes by linearized list of set of all supertypes. This concept is stolen from Scala, see also here: linearization.
  5. Allow singular inheritance from concrete types. That means, new concrete types can be defined by extending existing concrete types, if they do not add own state.
    Syntax e.g.: struct N <:S[<:A...] < end where S is has state, N has no own data fields, A additional abstract.
    Semantics: The new type shares state and layout with the old one (methods of course). Implicitly define default conversion function N(::S).
    Example: struct RichString <: String; blow_up::Function{RichString} end. Conversion: RichString("abc").
  6. Implement implicit conversions. In the case of concrete inheritance (5.), in a restricted context treat all objects x::S as N(x). That would, together with (5.), cover an essential property of traits. discourse
    Example: blow_up("def")
  7. Implement automatic delegation to methods of data members.
    Syntax e.g. struct S ...; delegate data::T ... end.
    Semantics: add all methods of T (known by interface definitions in T) to the method list of S and use them at runtime. Resolve conflicts by defining breadth/depth-first search. This contributes also this old problem: type mixin #816
  • Type stability
    Improve support for type stabilty.
  1. make the {Core.Inference|Base}.return_type[s] methods first class (documented, inBase).
  2. make the output more exact. For example return_type(cmp, (Real, Real)) should be Int64 and not Any.

to be continued

5 Likes