[rust-dev] 2 possible simplifications: reverse application, records as arguments

Patrick Walton pwalton at mozilla.com
Mon Apr 23 08:34:48 PDT 2012


On 04/21/2012 10:28 AM, gasche wrote:
> I've been wondering about a problem tightly related to named
> Re. function types: if you consider those parameter-passing structures
> as "first class" (which does necessarily mean that they are convenient
> to use, for example if they're not adressable they will be
> less flexible), the natural choice is to have a family of types for
> them. Those types could come with restrictions and an unspoken kinding
> discipline, so that for example they cannot be used to instantiate
> type variables, maybe cannot be nested, etc.
>
> That's the main reason why I think one should think of such structures
> as real structures rather than syntactic sugar; it forces you to have
> a proper design for types and other aspects.

There are several issues with going to tupled arguments:

* We'd still need formal parameters for C interoperability. At the ABI 
level, a single-argument function applied to a 3-ary tuple is very 
different from a function with 3 arguments.

* It prohibits us from having optional parameters in the future (at 
least, not without some very hairy typechecking).

* I don't know how to make the block loop syntax work.

Patrick


More information about the Rust-dev mailing list