dart-lang / dart-lang/language

Clarification on spec's text around implicit call tear-off

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

Description

The [spec I'm looking at](https://spec.dart.dev/DartLangSpecDraft.pdf) says:

> Case Implicit. Let _e_ be an expression whose static type is an interface
> type that has a method named `call`. In the case where the context type for _e_
> is a function type or the type `Function`, _e_ is treated as _e_`.call`.

Two questions:

1. Should "interface type that has a method named" instead be "interface type that has an instance method named"?
2. Does the text "interface type that has a method named" (or "interface type that has an instance method named") directly exclude extension methods? I think the intention is to exclude extension methods, as per [the static extension methods spec](https://github.com/dart-lang/language/blob/master/accepted/2.7/static-extension-methods/feature-specification.md), but I want to make sure that any language like "interface type that has a method" is exclusive of extension methods.

> This code will find, during type inference, that `2` is not a function. It will then find that the interface type `int` does not have a `call` method, and inference will fail to make the program valid.

> We could allow an applicable `call` extension method to be coerced instead, as an implicit tear-off. We will not do so.

Contributor guide

Open the contributing guide

Research direction

Read the cited Dart language specification section alongside the static extension methods feature specification. Determine whether “interface type that has a method named” excludes extension methods and whether “instance method” is needed, then document the agreed interpretation or resulting specification wording; the issue is done when both questions have an authoritative answer.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.