dart-lang / dart-lang/language
Eliminate excessive redundancy in the specification of semantically similar constructs
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
The language specification has always had a robust amount of redundancy in the specification of constructs like compound assignments (`v += e`, `C.x ~/= 42`, etc).
It is always bad for consistency and readability if "the same thing" is specified many times in different locations, but it is not immediately possible to eliminate this kind of redundancy:
We need to find the underlying concepts that allow us to specify that "same thing" once and for all, but there are many small deviations:
For example, an expression like `e1 == e2` is evaluated in a manner that takes the null object into account, which means that it is _not_ just the same thing as invoking the code in the most specific declaration of operator `==` on the dynamic type of `e1` with the value of `e2` as argument; and `v++` is treated differently when `v` is a local variable and when it is based on a getter/setter pair (which includes variables that induce getters/setters implicitly); and the static analysis of `e?.foo(42)` is specified in terms of `e.foo(42)`, but the dynamic semantics needs to be different, depending on whether we do or do not have `?`.
In other words, we may benefit considerably from removing many different kinds of redundancy in the language specification, but it is going to be a delicate exercise to make sure we still have the same language.
Because of this situation, I'd recommend that we do this as a separate effort, rather than eliminating a small snippet of redundancy of this kind here and there, in CLs that are otherwise concerned with other topics.
Contributor guide
Research direction
No files, tests, or entry points are named. Start by mapping the repeated specifications for compound assignments, equality, increment expressions, and conditional invocations, then identify shared concepts without changing their semantic exceptions. Done means the specification removes justified redundancy while preserving the existing language behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- documentation
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100