Whiley / RFCs

Request for Comment (RFC) proposals for substantial changes to the Whiley language.
3 stars 2 forks source link

Parameter Names for Mixed Types #71

Open DavePearce opened 4 years ago

DavePearce commented 4 years ago

Currently, one cannot specify parameter names for so called mixed types. The following illustrates a simple example from ACE.wy:

public type Editor is &{
    // Adds the selection and cursor.
    method addSelectionMarker(Range) -> (Range),
    ...
}

Here, the Range parameter (and return) cannot be given a name. For example, in the ACE API reference, we have this:

        addSelectionMarker(Range orientedRange)
            Range 

Adds the selection and cursor.

Therefore, I think it would be helpful overall to support the following:

public type Editor is &{
    // Adds the selection and cursor.
    method addSelectionMarker(Range orientedRange) -> (Range result),
    ...
}

Amongst other things, this would be helpful for doc documentation.