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

Cvs: Coercion et methode polymorphe #3417

Closed
vicuna opened this issue Jul 8, 2002 · 1 comment
Closed

Cvs: Coercion et methode polymorphe #3417

vicuna opened this issue Jul 8, 2002 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Jul 8, 2002

Original bug ID: 1226
Reporter: administrator
Assigned to: @garrigue
Status: closed (set by @garrigue on 2016-12-08T07:45:58Z)
Resolution: not a bug
Priority: normal
Severity: feature
Category: typing
Monitored by: vanicat

Bug description

Full_Name: Vanicat Rémi
Version: 3.04+15 (2002-06-18)
OS:
Submission from: ca-bordeaux-9-157.abo.wanadoo.fr (80.8.81.157)

Si on a un object comme celui ci :

class bar =

object
method virtual foo : 'a . 'a -> 'a
method foo x = x
end;;

et une fonction comme celle ci:

let f x = x #foo;;

alors je n'ai trouvé aucune façon d'utiliser la fonction f sur un objet de la
class
bar. Ne serais-t-il pas souhaitable de pouvoir faire une coercion d'un type
polymorphe
vers un type monomorphe ?

@vicuna
Copy link
Author

vicuna commented Dec 8, 2016

Comment author: @garrigue

C'est possible depuis une dizaine d'années je crois:

f (new bar : <foo : 'a. 'a -> 'a; ..> :> <foo : 'a -> 'a >);;

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