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

Test_d'exhaustivité #2742

Closed
vicuna opened this issue Apr 11, 2001 · 2 comments
Closed

Test_d'exhaustivité #2742

vicuna opened this issue Apr 11, 2001 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Apr 11, 2001

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

Bug description

Bonjour,

je ne sais pas si c'est un bug ou un changement volontaire du sens du
warning "this pattern-matching is not exhaustive", mais depuis la version
3.01, un pattern matching qui ne provoque pas de warning peut ne pas être
exhaustif:

function s when s = 0 -> ();;

(-> warning en 3.00, rien en 3.01)

Est-ce voulu ?

Je pense qu'un comportement conservatif (certains warnings inutiles, mais
ne pas laisser passer de filtrage partiel sans warning) est préférable,
quitte à changer le texte "this pattern-matching may ...".

--
Alain Frisch

@vicuna
Copy link
Author

vicuna commented May 2, 2001

Comment author: administrator

Bonjour,

je ne sais pas si c'est un bug ou un changement volontaire du sens du
warning "this pattern-matching is not exhaustive", mais depuis la version
3.01, un pattern matching qui ne provoque pas de warning peut ne pas être
exhaustif:

function s when s = 0 -> ();;

(-> warning en 3.00, rien en 3.01)

Est-ce voulu ?

C'est voulu si on veut. Mais manifestement certains utlisateurs prefere comme c,a. On tombe dans l'imfame probleme du pattern matching vide.
Tous ceux qui y ont recourt sont sense's savoir ce qu'ils font...
Personnellement je ne m'en sers jamais.

Je pense qu'un comportement conservatif (certains warnings inutiles, mais
ne pas laisser passer de filtrage partiel sans warning) est préférable,
quitte à changer le texte "this pattern-matching may ...".

Bof, au fond c,a ne change pas grand chose.
(Rassure toi, il reste des warnings inutiles)
Le manuel est clair. En pre'sence de clauses ``when'' il peut se passer
n'importe quoi.

En fait on peut utiliser le truc suivant :
Ne jamais mettre de when sur la dernierre clause comportant un motif donne'. C'est a dire, adopter un style if .. else if .. else...
Ici
genre

function s wehen s=0 -> ()
| _ -> assert false

Alors la derniere clause (celle qui correspond a` ``else'')
passe dans la verification d'exhaustivite' et tout se passe comme on
s'y attend.

--
Alain Frisch

@vicuna
Copy link
Author

vicuna commented May 2, 2001

Comment author: administrator

Always the same story about empty PM and exhsutiveness.
--Luc

@vicuna vicuna closed this as completed May 2, 2001
@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