Skip to content

Commit 35aca7f

Browse files
committed
Reword section Method Application
Will make it easier to explain later what happens when you apply a using method to explicit parameters
1 parent dad91f2 commit 35aca7f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/_spec/06-expressions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ ArgumentExprs ::= ‘(’ [Exprs] ‘)’
201201
Exprs ::= Expr {‘,’ Expr}
202202
```
203203

204-
An application `´f(e_1, ..., e_m)´` applies the expression `´f´` to the argument expressions `´e_1, ..., e_m´`.
205-
For the overal expression to be well-typed, ´f´ must be *applicable* to its arguments, which is defined next by case analysis on ´f´'s type.
204+
An application `´f(e_1, ..., e_m)´` applies the method `´f´` to the argument expressions `´e_1, ..., e_m´`.
205+
For this expression to be well-typed, the method must be *applicable* to its arguments:
206206

207207
If ´f´ has a method type `(´p_1´:´T_1, ..., p_n´:´T_n´)´U´`, each argument expression ´e_i´ is typed with the corresponding parameter type ´T_i´ as expected type.
208208
Let ´S_i´ be the type of argument ´e_i´ ´(i = 1, ..., m)´.
@@ -214,12 +214,12 @@ Once the types ´S_i´ have been determined, the method ´f´ of the above metho
214214
- for every positional argument ´e_i´ the type ´S_i´ is [compatible](03-types.html#compatibility) with ´T_i´;
215215
- if the expected type is defined, the result type ´U´ is [compatible](03-types.html#compatibility) to it.
216216

217-
If ´f´ is a polymorphic method, [local type inference](#local-type-inference) is used to instantiate ´f´'s type parameters.
218-
The polymorphic method is applicable if type inference can determine type arguments so that the instantiated method is applicable.
219-
220-
If ´f´ has some value type, the application is taken to be equivalent to `´f´.apply(´e_1, ..., e_m´)`, i.e. the application of an `apply` method defined by ´f´.
221-
The value `´f´` is applicable to the given arguments if `´f´.apply` is applicable.
217+
If ´f´ is instead of some value type, the application is taken to be equivalent to `´f´.apply(´e_1, ..., e_m´)`, i.e. the application of an `apply` method defined by ´f´.
218+
Value `´f´` is applicable to the given arguments if `´f´.apply` is applicable.
222219

220+
Note:
221+
In the case where ´f´ or `´f´.apply` is a polymorphic method, this is taken as an [ommitted type application](#type-applications).
222+
`´f´` is applicable to the given arguments if the result of this type application is applicable.
223223

224224
The application `´f´(´e_1, ..., e_n´)` evaluates ´f´ and then each argument ´e_1, ..., e_n´ from left to right, except for arguments that correspond to a by-name parameter (see below).
225225
Each argument expression is converted to the type of its corresponding formal parameter.

0 commit comments

Comments
 (0)