Difference between revisions of "Beyond D2"
Timotheecour (talk | contribs) (→Features to add) |
Timotheecour (talk | contribs) |
||
Line 18: | Line 18: | ||
* full UFCS support: foo.mixin, foo.assert, foo.stringof, foo.typeof | * full UFCS support: foo.mixin, foo.assert, foo.stringof, foo.typeof | ||
− | == | + | |
− | * | + | == Arrays == |
+ | * multidimensional indexing and slicing: | ||
+ | ** https://github.com/D-Programming-Language/dmd/pull/443 | ||
+ | ** http://homepages.uni-regensburg.de/~nen10015/documents/D-multidimarray.html | ||
+ | * builtin slices with begin..end:step or begin..end..step | ||
+ | * slices are structs | ||
== Features to drop == | == Features to drop == | ||
Line 54: | Line 59: | ||
* language syntax for tuples; unify syntax for compile time tuples with runtime tuples | * language syntax for tuples; unify syntax for compile time tuples with runtime tuples | ||
** could follow DIP32 but use (a,b) syntax instead; we would get rid of C-style expression lists to enable this | ** could follow DIP32 but use (a,b) syntax instead; we would get rid of C-style expression lists to enable this | ||
− | |||
− | |||
− | |||
− | |||
== Compilation == | == Compilation == | ||
Line 69: | Line 70: | ||
* Compiler written in D2, and then bootstrapped from their as done in rust and many other languages | * Compiler written in D2, and then bootstrapped from their as done in rust and many other languages | ||
− | * Incremental compilation support ( | + | |
+ | == Tooling == | ||
+ | * improved dmd/rdmd command line: http://wiki.dlang.org/DIP41 | ||
+ | * Incremental compilation support in rdmd ("Add --incremental option to rdmd": http://d.puremagic.com/issues/show_bug.cgi?id=9673 or ) | ||
+ | |||
== More controversial features to add == | == More controversial features to add == |
Revision as of 02:28, 10 November 2013
Contents
Motivation
This page can be used as a centralized place to discuss parts of D2's design that are controversial, undesirable or that could be improved, including those that are too late to fix in D2. Also discussed here are features that would be worthy of consideration in a hypothetical successor for D2 (D3? E? ). This page came up from email thread [1];
Questionable design choices
- is virtual by default a good idea with separate compilation model?
Syntax changes
- get rid of C-style expression lists in parenthesis; these would be reserved for tuples
- Go style a := b meaning auto a = b
- semi-column optional
- Go style lightweight if/while/etc expressions that don't require () around the if statement:
while x>=0 {...}
- full UFCS support: foo.mixin, foo.assert, foo.stringof, foo.typeof
Arrays
- multidimensional indexing and slicing:
- builtin slices with begin..end:step or begin..end..step
- slices are structs
Features to drop
- strings: stop conflating range of code points with range of code units:
- "foo" represents a range of code points
- "foo".rep represents a range of code units, eg: immutable(char)[]
- This would remove a *lot* of special case code in phobos and make it easier to write generic code, eg, would remove need for distinguishing ElementType vs ForeachType
- I've discussed this in email:"iteration over a string"
- Andrei mentioned it here as well: http://forum.dlang.org/post/l3h49k$b6$1@digitalmars.com
"It is my opinion that a better solution exists (in the form of making representation accessible only through a property .rep)"
- drop built-ins: foreach_reverse, sort
- stop conflating paths with strings; would make a lot of code safer and cross platform; would still allow implicit conversion via alias this.
- can we get rid of @property?
Features to add
- AST macros
- would enable many features; eg:
- supersedes: "proposal: a new string litteral to embed variables in a string"
- supersedes: "feature request: __ARGS__ for logging (cf __FILE__, __LINE__, __FUNC___)"
- would enable many features; eg:
- python style named parameter arguments
- Yield return
- R-value references
- Safe references
- language syntax for tuples; unify syntax for compile time tuples with runtime tuples
- could follow DIP32 but use (a,b) syntax instead; we would get rid of C-style expression lists to enable this
Compilation
- proposal: lazy compilation model for compiling binaries: http://forum.dlang.org/post/mailman.1357.1371876331.13711.digitalmars-d@puremagic.com
- allow JIT (to be used sparingly), to allow runtime eval statements.
- Compiler as a library (eg llvm/clang toolchain)
- Compiler written in D2, and then bootstrapped from their as done in rust and many other languages
Tooling
- improved dmd/rdmd command line: http://wiki.dlang.org/DIP41
- Incremental compilation support in rdmd ("Add --incremental option to rdmd": http://d.puremagic.com/issues/show_bug.cgi?id=9673 or )
More controversial features to add
- store code as AST,
- The 1st idea is to get rid of styleguides completely and allow people to read/write code with their preferred style. Codes gets stored and exchanged as AST; clients read the AST and converts it on the fly as source code in the user's preferred formatting.
- speeds up compilation: only currently modified code needs to get translation from source to AST
- More future proof and eases refactoring
- Allow transparently including C headers in code as in Go; could use swig behind the scenes
[1] Related email thread: 'Maintain notes for D's successor? [Was: Re: Why the @ in @safe? & UDAs]'