caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Fabrice Le Fessant <fabrice.le_fessant@inria.fr>
To: "Diego Olivier Fernandez Pons" <FernandezPons@iFrance.com>
Cc: "Luc Maranget" <luc.maranget@inria.fr>, "Caml" <caml-list@inria.fr>
Subject: Re: [Caml-list] Pattern matching
Date: Tue, 13 Nov 2001 09:00:08 +0100 (CET)	[thread overview]
Message-ID: <15344.54024.333924.7353@lachesis.inria.fr> (raw)
In-Reply-To: <00b101c16b58$eacbbf80$9571f2c3@Utilisateur>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 2080 bytes --]



> Mon « argumentation » consiste à exhiber de mauvais programmes car je
> considère qu'un « bon » langage ne doit pas laisser un mauvais
> programmeur faire du mauvais code (dans la mesure du possible). Quand
> je dois passer trois heures à relire le code d'une tierce personne et
> que je me rends compte que l'erreur est dûe à la fonction suivante :

C'est aussi faux que de dire qu'une bonne loi previent tout
delit. Qu'est ce qui empechera un mauvais programmeur de croire que
ton "match" sans liaison est en fait avec liaison ? Si je pousse a
l'extreme, je mets un singe devant mon clavier, et j'envoie des
rapports de bugs pour chaque phrase tappee que le compilateur
n'accepte pas ?

> I was just proposing :
> - to use the « match with » syntax for value matching only
> - to allow the use of bounded variables in the value matching
> - to leave the structure match as it is of course

Pourquoi changer ce dont tout le monde a part toi est heureux ? Tu
fais du pattern-matching hyper-simple (deux a trois cas sans liaison)
qui serait probablement cent fois mieux traite par un "if", et tu
rales. Ce n'est pas le programmeur qui s'est plante, c'est celui qui
lui a appris qu'il fallait utilise un "match" la ou il aurait du
utiliser un "if".

Essaie donc de faire du pattern-matching avec 30 cas (un arbre de
syntaxe par exemple), et tu te rendras compte que le pattern-matching
avec liaison est mille fois plus utile ! Je te vois mal ecrire
l'equivalent du compilateur de ocaml avec ce pattern-matching que tu
proposes... 

Exercice 1 d'une modification de syntaxe: prendre un code existant et
le traduire dans ta syntaxe. Je te propose de jeter un oeil a
typing/typecore.ml ...

I was just proposing:
- to use << match with >> on complex structures.
- to use << if >> on simple structures where no binding is required.
- to learn the semantics of a construct before using it.

- Fabrice

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-11-13  8:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-08  2:33 Diego Olivier Fernandez Pons
2001-11-09  0:26 ` Pixel
2001-11-09 10:59   ` Luc Maranget
     [not found] ` <15339.34220.198731.791811@lachesis.inria.fr>
2001-11-10  2:16   ` Diego Olivier Fernandez Pons
2001-11-12 10:29     ` Luc Maranget
2001-11-12  9:00       ` Diego Olivier Fernandez Pons
2001-11-13  8:00         ` Fabrice Le Fessant [this message]
2001-11-13 23:57           ` [Caml-list] If ou Pattern-matching ? Diego Olivier Fernandez Pons
2001-11-14 10:02             ` Fabrice Le Fessant
2001-11-14 10:47             ` Nicolas Barnier
2001-11-14  1:26               ` [Caml-list] Warnings possibles Diego Olivier Fernandez Pons
2001-11-14 18:24                 ` Luc Maranget
2001-11-14 11:35             ` [Caml-list] If ou Pattern-matching ? Luc Maranget
2001-11-13 16:09         ` [Caml-list] Pattern matching Luc Maranget
2001-11-13 23:56           ` [Caml-list] Deux types de pattern-matching ? Diego Olivier Fernandez Pons
2001-11-14 10:19             ` [Caml-list] " Luc Maranget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15344.54024.333924.7353@lachesis.inria.fr \
    --to=fabrice.le_fessant@inria.fr \
    --cc=FernandezPons@iFrance.com \
    --cc=caml-list@inria.fr \
    --cc=luc.maranget@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).