dart-lang / site-www

Source for Dart website
https://dart.dev
Other
968 stars 696 forks source link

Add contextualized examples to the 'Pattern types' page #5425

Open petro-i opened 10 months ago

petro-i commented 10 months ago

Page URL

https://dart.dev/language/pattern-types

Page source

https://github.com/dart-lang/site-www/blob/main/src/content/language/pattern-types.md

Describe the problem

Pattern doc is very weak. Examples are out of context, it is difficult to figure out real scenario of almost all of the patterns, for example "Logical-and" example looks 100% artificial and use-less. Inline comments are missing for code examples.

Honestly, I used ChatGPT to convert such non-human doc to the doc average human can understand.

Expected fix

No response

Additional context

No response

I would like to fix this problem.

parlough commented 10 months ago

Hi @petro-i, thanks for opening an issue and providing us with this feedback!

The goal of this page was to act as more of a quick reference for what types of patterns exist and their syntax, while the core Patterns page intends to be more like a guide with contextualized explanations.

We definitely can still improve both pages though, including with more comments, more realistic examples, etc. It's always a challenge to find a balance of conciseness and realism in examples, as they have different uses.

To help us determine some more concrete next steps, would you be able to point out some specific comments that would have helped, or perhaps an example you would like to see?

You mentioned ChatGPT provided you with some more helpful understanding. Could you share a specific example?

Thanks so much!