Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A single wildcard for n-ary type constructors #6374

Closed
vicuna opened this issue Apr 18, 2014 · 2 comments
Closed

A single wildcard for n-ary type constructors #6374

vicuna opened this issue Apr 18, 2014 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Apr 18, 2014

Original bug ID: 6374
Reporter: @alainfrisch
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:29:28Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 4.02.0
Category: typing
Tags: patch
Related to: #5528
Monitored by: @jmeber @yallop @hcarty @yakobowski

Bug description

I propose to accept the type expression "_ t" when "t" is a type constructor with more than one argument. This makes it easier, for instance, to write:

("%s" : _ format)

and this is very coherent with the behavior of patterns on n-ary constructors.

I attach a trivial patch.

A further motivation is for the work on inlined records (#5528): the implicit inner record types are given type variables derived from the free variables in the record definition. It's better if one can add a type annotation on those t.A record types without having to care about their exact arity.

I'll commit this patch in a few days unless someone objects to it.

File attachments

@vicuna
Copy link
Author

vicuna commented Apr 20, 2014

Comment author: @garrigue

I understand your point, and there is a good argument that it matches the use of wildcards in pattern matching.
However, this is an important change, and I think it should be discussed on the developer's list.

@vicuna
Copy link
Author

vicuna commented Sep 25, 2014

Comment author: @alainfrisch

This was committed by mistake in commit 14659 (which means it went out in 4.02, sorry!). Since then, this was discussed on caml-devel, there was some positive feedback and no opposition, and so I'll leave it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants