dart-lang / dart-lang/language

Allow generic type names to be overloaded by type parameter arity

Open
#742 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

C# allows reusing an identifier for non-generic and generic classes of differing arity (number of parameters) within the same namespace:

```
class Queue { }
class Queue : Queue {}
class Queue : Queue {}
class Queue : Queue {}

class Ant {}
class Ant {}
class Ant {}
class Ant {}
```

This is a common, beloved and useful feature in C#. As shown above with the ```Ant``` classes, there need not be a relationship between classes of the same name, though an argument could be made that a generic *must* have the non-generic class as an ancestor as show with the ```Queue``` classes.

Please add this feature to Dart. As a professional tools creator, resorting to convoluted naming conventions is the only work-around for this limitation.

For more information about this feature in C#, check out the section [Constructed Types](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/types#constructed-types).

Contributor guide

Open the contributing guide

Research direction

No Dart files or tests are identified in the issue. Start by reviewing Dart's existing generic declaration and name-resolution rules, then compare them with the linked C# Constructed Types reference; done means Dart supports declarations sharing an identifier while differing in type-parameter arity, with the intended relationship rules defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.