dart-lang / dart-lang/language

Can part directives be improved

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

Description

In order to create part files in dart, we need to write part directives in all the part files like this

**1. Base file**
```dart
part 'my_file.g.dart'
```
And in the part file
```dart
part of 'my_file.dart'
```

I think in augmentation library, we also need to write augmentation directives in all the files.

My question is if we can implement **part** or **augmentation** by writing related directives in only one file, either of both. Like when I already told the compiler that the base file has a part file named `'my_file.g.dart'`, then why i need to tell the compile again that the part file is of the file named `'my_file.dart'` and vice versa. This seems ridiculous.

Suppose we don't need to write **part of** directive in the part file, we can define a part file in multiple base files. On the other side if we can omit **part** directive in _base file_. All we need to do is to write **part of** directive in the part file. This looks good.

This can be tried in **augmentation library** also.

Contributor guide

Open the contributing guide

Research direction

Start with the issue's examples of Dart part and augmentation directives, then review the language-design discussion in this repository. Compare the proposed one-sided directive forms and consider how they affect ownership and ambiguity. Done means reaching and documenting a language-design decision, not merely changing one file.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.