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

mauvais type pour Pervasives.format_of_string #8226

Closed
vicuna opened this issue Jul 25, 2003 · 5 comments
Closed

mauvais type pour Pervasives.format_of_string #8226

vicuna opened this issue Jul 25, 2003 · 5 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 25, 2003

Original bug ID: 1774
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Bonjour,

pervasives.ml contient :

external string_to_format :
string -> ('a, 'b, 'c, 'd) format4 = "%identity"

mais dans le .mli :

external format_of_string :
('a, 'b, 'c, 'd) format4 -> ('a, 'b, 'c, 'd) format4 = "%identity"

--
Olivier

@vicuna
Copy link
Author

vicuna commented Jul 25, 2003

Comment author: administrator

pervasives.ml contient :

external string_to_format :
string -> ('a, 'b, 'c, 'd) format4 = "%identity"

mais dans le .mli :

external format_of_string :
('a, 'b, 'c, 'd) format4 -> ('a, 'b, 'c, 'd) format4 = "%identity"

Ce n'est pas contradictoire. string_to_format est une fonction interne
de Pervasives, non exportée (car non sûre vis-à-vis du typage).

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Jul 25, 2003

Comment author: administrator

These are the inteded types.

@vicuna vicuna closed this as completed Jul 25, 2003
@vicuna
Copy link
Author

vicuna commented Jul 25, 2003

Comment author: administrator

Xavier Leroy [Friday 25 July 2003] :

pervasives.ml contient :

external string_to_format :
string -> ('a, 'b, 'c, 'd) format4 = "%identity"

mais dans le .mli :

external format_of_string :
('a, 'b, 'c, 'd) format4 -> ('a, 'b, 'c, 'd) format4 = "%identity"

Ce n'est pas contradictoire. string_to_format est une fonction interne
de Pervasives, non exportée (car non sûre vis-à-vis du typage).

Désolé, je me suis emmêlé les pinceaux entre les string, les format,
les of et les to :)

J'essayait de comprendre l'intérêt de format_of_string. Je crois avoir
compris, c'est pour forcer une string litérale à avoir un type format.

--
Olivier

@vicuna
Copy link
Author

vicuna commented Jul 25, 2003

Comment author: administrator

[...]

J'essayait de comprendre l'intérêt de format_of_string. Je crois avoir
compris, c'est pour forcer une string litérale à avoir un type format.

--
Olivier

Voilà ce que dit la documentation:

(** [format_of_string s] returns a format string read from the string
literal [s]. *)

Pensez-vous qu'il faille d'autres explications ?

Cordialement,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/

@vicuna
Copy link
Author

vicuna commented Jul 25, 2003

Comment author: administrator

Pierre Weis [Friday 25 July 2003] :

[...]

J'essayait de comprendre l'intérêt de format_of_string. Je crois avoir
compris, c'est pour forcer une string litérale à avoir un type format.

--
Olivier

Voilà ce que dit la documentation:

(** [format_of_string s] returns a format string read from the string
literal [s]. *)

Pensez-vous qu'il faille d'autres explications ?

Je n'ai pas été trés clair : je me demandais dans quel contexte on
pouvait avoir à utiliser une telle fonction (je n'en avais jamais
éprouvé le besoin avant). Quant à avoir d'autres explications,
peut-être ... c'est la seule fonction s'appelant "type1_of_type2" et
qui n'est pas du type `type2 -> type1', c'est troublant ! Peut-être
qu'en l'appelant format_of_string_literal son rôle serait plus
clair ?

Sinon, dans la documentation des "built-in types", je lis :
type ('a, 'b, 'c, 'd) format
ça devrait être
type ('a, 'b, 'c, 'd) format4
non ?

http://caml.inria.fr/ocaml/htmlman-beta/manual033.html

--
Olivier

@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant