www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23133] New: Timon's list of enhancement requests

https://issues.dlang.org/show_bug.cgi?id=23133

          Issue ID: 23133
           Summary: Timon's list of enhancement requests
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

Taken from https://forum.dlang.org/post/sk4v9b$2apt$1 digitalmars.com :

This is likely to be incomplete or overly abstract, but here's my approximate
take:

 * Worst features implemented in a non-toy language
- unsound type system - undefined behavior for categories of errors other than memory corruption - inappropriately nondeterministic semantics - mutable aliasing by default (mutability is fine, aliasing is the issue) - pointer arithmetic without appropriate type system support - imprecise type system (>40 years behind state of the art) - non-orthogonal language definition - null pointers without appropriate type system support - Turing-complete constructors
 * Worst features (in your opinion) in D
- undefined behavior for categories of errors other than memory corruption, e.g. 'assert' - safe `void` initialization - safe extern(C) function prototypes - inout - nondeterministic floating-point semantics - forward reference errors/ambiguities (arising from underspecification of compile-time introspection) - .init - separation of templates and CTFE - null pointers - Turing-complete constructors - Object - interaction of type qualifiers with reference types - underspecification of type/function qualifiers - template syntax is inconsistent between declaration and call site - alias this (it uses lookup rules different from import) - slicing and indexing of sequences is magic, there is no way to slice a library tuple without decaying into an auto-expanding sequence
 * Features you'd like to see in D
- built-in tuples/products with standard syntax - built-in tagged unions/sums, nullable, algebraic data types - pattern matching - real support for linear/affine typing - named parameters with support for perfect forwarding and compile-time introspection - built-in duck-typed record types playing nice with named parameters - type classes / some standard way to add UFCS methods to a type from another module that are then visible in an instantiated template from a third module - uniform syntax for function definition, in particular `int add(int a,int b)=>a+b;` (-preview=shortenedMethods) - `let Statement in Expression` expression - `Expression where Statement` expression - mixin identifiers - __local, static break and continue (https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1010.md) - template literals - static opIndex/opSlice - AST introspection - consistent treatment of operators for built-in types, e.g. 1.opBinary!"+"(2) should work. - operator overloading should combine orthogonally with UFCS - better support for subtyping (expose the concept to user-defined types, e.g., Range!(const(T)) could be a subtype of const(Range!T)) and any other features required to support a good container library - async/await (or similar) - yield (or similar) - range literals - more lightweight coroutines - ProtoObject - special treatment of qualified types, in particular qualified reference types (e.g. `immutable` classes should allow conversion of references from `immutable` to mutable) - non-deterministic semantics, with as little undefined behavior as possible, in particular for type/function qualifiers - compile-time fixed-point support (e.g., with struct S(T){ T* next; }, fix!S gives a singly linked list). - flow-sensitive typing - strong variable updates (probably not happening) - non-lexical variable lifetimes (probably not happening) - parametric polymorphism, in particular for type qualifiers (probably not happening) - some amount of dependent types (dreaming now) --
May 21 2022