caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Vincent Aravantinos <vincent.aravantinos@yahoo.fr>
Cc: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>,
	oleg@pobox.com, caml-list@inria.fr
Subject: Re: [Caml-list] Unsoundness is essential
Date: Thu, 04 Oct 2007 11:49:56 +1000	[thread overview]
Message-ID: <1191462596.7542.73.camel@rosella.wigram> (raw)
In-Reply-To: <38BB2D08-E5D5-4A02-A3BF-7B0B51C2311F@yahoo.fr>

On Thu, 2007-10-04 at 01:13 +0200, Vincent Aravantinos wrote:
> Le 4 oct. 07 à 00:50, skaller a écrit :

> > To be bold I propose type theorists have got it totally wrong.
> > ...
> > expressive type systems. Stop CHEATING by refusing to allow
> > me to write types you can't check -- because this forces
> > ME as the programmer to cheat on the type annotations:
> >
> > 	divide: int * int -> int
> > 	hd : 'a list -> 'a
> 
> If you allow everything (such as the "type expressive" C you are  
> envisaging), the programmer will be tempted to use this "everything"  
> whereas he could achieve the same with a "bounded" language. 

Yes, this is a valid criticism. Can you please help refine my idea
to take this into account?

What we want is to push the programmer into using the most
checkable form, and only let them 'escape' if it is really
necessary (I hope you agree with that summary!)

But I have no idea how to do that in a coherent way.
A kind of Occam's Razor of programming .. :)

In C++, this is done by encouraging programmers not
to use casts, but still allowing them, and indeed,
providing a more refined and pointed set of casts as well:

	static_cast, dynamic_cast, const_cast, 
	reinterpret_cast

These are long winded (deliberately) and frowned upon so there
is both mechanical (I hate typing) and psychological (peer
pressure, pride, etc) pressure NOT to use casts, and this
is encourage by the fact that C++ needs a LOT LESS casts
than C.

In Ocaml .. Obj.magic is 'evil' and not documented..

But this is a really WEAK form of pressure.

> To my eyes it looks like many things that appeared in other languages  
> to appeal the programmers, but that could be achieved in other (did I  
> say better ?) ways. If you allow everything, people will be tempted  
> to do anything... And any progress in computer science will never  
> catch the gap.

Yes, but the problem now is that all these new languages are
coming out and the designed IGNORE all the good academic work.
Java, Ruby .. to name two examples of *new* rubbish which are
immensely popular, whilst Ocaml and Haskell haven't taken off.

> I think it's a good thing to constrain the programmer.

No dispute. I'm not arguing for NO constraints. In fact
it is the other way around. I'm arguing to allow the programmer
to apply MORE constraints in the form of more expressive types
EVEN IF THESE CONSTRAINTS CANNOT BE ENFORCED.

>  How many times  
> I thought "that's a pity I can't do this *as I want* in ocaml". And  
> then after having been forced to think of another way to achieve my  
> goal *within the constraints of ocaml*, I ended with something like  
> "woah, actually it's better this way!".

Yes. I have to tell you that I use this idea systematically
as a programming technique!

However many things annoy me, some of which I have tried to
fix in Felix. One of them is that modules/functor do not
allow expression of semantic rules: Felix has typeclasses
WITH semantic rules.

Although the rules are limited, Felix can actually generate
a vast battery of axiom checks, and, it currently emits
theorem claims in Why encoding which allows the claims
to be checked by various theorem provers, including Ergo.

None of this comes close to doing what I actually need in
the Ocaml code of the compiler itself, which is a to enforce
invariants of the term rewriting system in the type system.


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2007-10-04  1:55 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-03  8:35 Locally-polymorphic exceptions [was: folding over a file] oleg
2007-10-03 11:27 ` kirillkh
2007-10-03 11:48   ` [Caml-list] " Daniel de Rauglaudre
2007-10-03 12:19     ` kirillkh
2007-10-03 12:32       ` Daniel de Rauglaudre
2007-10-03 14:34         ` kirillkh
2007-10-03 20:39   ` Christophe Raffalli
2007-10-03 22:50     ` Unsoundness is essential skaller
2007-10-03 23:13       ` [Caml-list] " Jacques Carette
2007-10-04  1:24         ` skaller
2007-10-04 11:26           ` David Allsopp
2007-10-04 12:45             ` Vincent Hanquez
2007-10-04 15:07               ` skaller
2007-10-03 23:13       ` Vincent Aravantinos
2007-10-04  1:49         ` skaller [this message]
2007-10-03 23:28       ` Joshua D. Guttman
2007-10-04  1:52         ` skaller
2007-10-04  2:35           ` Brian Hurt
2007-10-04  7:46           ` Christophe Raffalli
2007-10-04  8:56             ` Arnaud Spiwack
2007-10-04 14:49               ` skaller
2007-10-04 15:00                 ` Harrison, John R
2007-10-04 15:29                 ` Andrej Bauer
2007-10-04 16:25                   ` skaller
2007-10-04 18:17                     ` Arnaud Spiwack
2007-10-04 20:54                       ` skaller
2007-10-04 22:24                         ` Arnaud Spiwack
2007-10-04 16:37                   ` skaller
2007-10-04 18:59                     ` Christophe Raffalli
2007-10-04 15:04               ` Andrej Bauer
2007-10-04 15:57                 ` Christophe Raffalli
2007-10-04 16:03                 ` skaller
2007-10-04 20:02                   ` Ken Rose
2007-10-04 21:00                     ` skaller
2007-10-04 15:31       ` Lukasz Stafiniak
2007-10-04 17:56       ` rossberg
2007-10-04 19:56         ` skaller
2007-10-04 21:07           ` rossberg
2007-10-04 22:23             ` skaller
2007-10-05  2:48               ` Bárður Árantsson
2007-10-04  2:16   ` Locally-polymorphic exceptions [was: folding over a file] oleg

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=1191462596.7542.73.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=Christophe.Raffalli@univ-savoie.fr \
    --cc=caml-list@inria.fr \
    --cc=oleg@pobox.com \
    --cc=vincent.aravantinos@yahoo.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).