Skip to content

Add proposal to drop support for the old function syntax - #4782

Merged
munificent merged 4 commits into
mainfrom
remove-old-function-syntax
Sep 30, 2026
Merged

munificent merged 4 commits into
mainfrom
remove-old-function-syntax

Conversation

@munificent

@munificent munificent commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Removes:

  • Function-typed parameters.
  • Function type typedefs.

- Function-typed parameters.
- Function type typedefs.
@munificent
munificent requested review from eernstg and lrhn September 28, 2026 22:31
@munificent munificent changed the title Add proposal to drop support for the old function syntax: Add proposal to drop support for the old function syntax Sep 28, 2026

@lrhn lrhn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Snip it!

@eernstg eernstg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! In addition to getting this done, it serves as a reminder why we really want to do this. ;-)

LGTM

copybara-service Bot pushed a commit to dart-lang/sdk that referenced this pull request Sep 30, 2026
We have had a core lint for over five years encouraging users to move
away from the old function typedef syntax to the new generalized
typedef syntax. We should probably take our own advice.

This is particularly relevant to:

dart-lang/language#4782

But even if we don't remove support for the old syntax, our own code
should still be idiomatic.

Also enabled the lint in the packages where I could. This CL does not
fix uses of the old typedefs in generated web libraries. I'll fix the
generator and send out a separate CL for that after this lands:

https://dart-review.googlesource.com/c/sdk/+/557020

TEST=Purely mechanical syntax change
CoreLibraryReviewExempt: Purely mechanical syntax change
Change-Id: I94fa1ec73f0ea5b6c8a0dece4f903b12852052d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/556942
Auto-Submit: Bob Nystrom <[email protected]>
Reviewed-by: Alexander Aprelev <[email protected]>
Commit-Queue: Bob Nystrom <[email protected]>
Reviewed-by: Lasse Nielsen <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
@munificent
munificent merged commit 930f15f into main Sep 30, 2026
10 checks passed
@munificent
munificent deleted the remove-old-function-syntax branch September 30, 2026 21:15
munificent added a commit to dart-lang/dartdoc that referenced this pull request Oct 21, 2026
When Dartdoc generates documentation for a function with a parameter
whose type is a function type (i.e. a callback), the generated docs use
the old pre-Dart-2.0 function-typed parameter syntax. Dartdoc does this
even if the function itself uses the newer syntax.

For over five years, we have had a recommended lint telling users not to
use the old function-typed parameter syntax. Newer Dart users may not be
familiar with it at all. Our generated docs should probably use the same
syntax that we recommend that users write. :)

Also, I am working on a proposal to drop support for the old
function-typed parameter syntax completely. If that happens, then we
should definitely stop using the old non-existent syntax. (See
dart-lang/language#4782).

This obviously affects the output of Dartdoc pretty significantly, so
I'm not sure what landing this entails, but I figured I'd put together a
PR and send it out to start that discussion. If now is not the right
time to make a change like this, that's OK too, but I do think we should
make this change at some point.

Fix #3671.
sgrekhov pushed a commit to sgrekhov/dartdoc that referenced this pull request Oct 22, 2026
When Dartdoc generates documentation for a function with a parameter
whose type is a function type (i.e. a callback), the generated docs use
the old pre-Dart-2.0 function-typed parameter syntax. Dartdoc does this
even if the function itself uses the newer syntax.

For over five years, we have had a recommended lint telling users not to
use the old function-typed parameter syntax. Newer Dart users may not be
familiar with it at all. Our generated docs should probably use the same
syntax that we recommend that users write. :)

Also, I am working on a proposal to drop support for the old
function-typed parameter syntax completely. If that happens, then we
should definitely stop using the old non-existent syntax. (See
dart-lang/language#4782).

This obviously affects the output of Dartdoc pretty significantly, so
I'm not sure what landing this entails, but I figured I'd put together a
PR and send it out to start that discussion. If now is not the right
time to make a change like this, that's OK too, but I do think we should
make this change at some point.

Fix dart-lang#3671.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants