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

weak variables '_a should be documented in the manual #6225

Closed
vicuna opened this issue Nov 4, 2013 · 4 comments
Closed

weak variables '_a should be documented in the manual #6225

vicuna opened this issue Nov 4, 2013 · 4 comments

Comments

@vicuna
Copy link

vicuna commented Nov 4, 2013

Original bug ID: 6225
Reporter: DYNO_doxa
Assigned to: @Octachron
Status: resolved (set by @Octachron on 2017-10-16T06:58:35Z)
Resolution: fixed
Priority: low
Severity: minor
Platform: i386
OS: XP
OS Version: SP3
Version: 4.01.0
Fixed in version: 4.06.0 +dev/beta1/beta2/rc1
Category: documentation
Tags: junior_job
Related to: #5607

Bug description

Defining

let new_array = Array.make 7

returns a surprising type

'_a -> '_a array

that is not documented in the manual.

Steps to reproduce

compile and see:

module Days = struct
let newArrayOf = Array.make 7
end

@vicuna
Copy link
Author

vicuna commented Nov 4, 2013

Comment author: @yallop

The function receives a weakly polymoprhic type, which is the expected behaviour:

module Days : sig val newArrayOf : '_a -> '_a array end

See the FAQ entries:

The type of this expression contains type variables that cannot be generalized
http://caml.inria.fr/resources/doc/faq/core.en.html#weak-type-variables

A function obtained through partial application is not polymorphic enough
http://caml.inria.fr/resources/doc/faq/core.en.html#eta-expansion

@vicuna
Copy link
Author

vicuna commented Nov 5, 2013

Comment author: DYNO_doxa

no mention of "weakly polymoprhic [!] type" in the manual, though

@vicuna
Copy link
Author

vicuna commented Nov 5, 2013

Comment author: @gasche

This is a documentation issue (I thought there were documented outside the fact, but couldn't find the reference again). I updated the PR to reflect that this is not a bug.

@vicuna
Copy link
Author

vicuna commented Oct 16, 2017

Comment author: @Octachron

The new chapter on polymorphic functions and types introduces explicitly the notion of weakly polymorphic types (which were already mentionned in the FAQ of the compiler chapter).

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