From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 7FC468239C for ; Wed, 31 Jan 2018 22:14:33 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=lorenzo.pomili85@gmail.com; spf=Pass smtp.mailfrom=lorenzo.pomili85@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f49.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of lorenzo.pomili85@gmail.com) identity=pra; client-ip=74.125.82.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="lorenzo.pomili85@gmail.com"; x-sender="lorenzo.pomili85@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of lorenzo.pomili85@gmail.com designates 74.125.82.49 as permitted sender) identity=mailfrom; client-ip=74.125.82.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="lorenzo.pomili85@gmail.com"; x-sender="lorenzo.pomili85@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wm0-f49.google.com) identity=helo; client-ip=74.125.82.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="lorenzo.pomili85@gmail.com"; x-sender="postmaster@mail-wm0-f49.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AjWQFkBD1fLyayMxFlaxbUyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSPv5pcbcNUDSrc9gkEXOFd2Cra4c0qyO6+jJYi8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6?= =?us-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rJtJEDLOCOw0OdEKn8Du08FdMKvkEeLCGcBaHO7Xq?= =?us-ascii?q?Z67TY+Wtr/UNXzA7u1ibnE5x+VW51bYmccVwKJGHbsMpqBA7ICNHPULchmnTgJ?= =?us-ascii?q?E7OmTt152A=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0D6ZgDfMHJahjFSfUpdHQEBHQEGAYNWA?= =?us-ascii?q?YEzKAqDVoE5lxeGAoUKgQBLhBSDCYVVghYKiAUHGQcEOQ8BAQEBAQEBAQEBARI?= =?us-ascii?q?BAQEICwsIKC+COCKCcwQZARseAxIJAQY3AiQBEQEFAYpRAQMVmAODRUCMFIFtG?= =?us-ascii?q?AUBHIMLBYNhChknDVmCdQIGEoRJghWGPQGGHYJLgmUFgS0BAYZSnBMIAQGBcBe?= =?us-ascii?q?OCoVblC2XVRQFIIEXSQGBXjMaI4EEUoEmgmWCE0A3jCgBAQE?= X-IPAS-Result: =?us-ascii?q?A0D6ZgDfMHJahjFSfUpdHQEBHQEGAYNWAYEzKAqDVoE5lxe?= =?us-ascii?q?GAoUKgQBLhBSDCYVVghYKiAUHGQcEOQ8BAQEBAQEBAQEBARIBAQEICwsIKC+CO?= =?us-ascii?q?CKCcwQZARseAxIJAQY3AiQBEQEFAYpRAQMVmAODRUCMFIFtGAUBHIMLBYNhChk?= =?us-ascii?q?nDVmCdQIGEoRJghWGPQGGHYJLgmUFgS0BAYZSnBMIAQGBcBeOCoVblC2XVRQFI?= =?us-ascii?q?IEXSQGBXjMaI4EEUoEmgmWCE0A3jCgBAQE?= X-Spam-Status: Yes X-IronPort-AV: E=Sophos;i="5.46,441,1511823600"; d="scan'208,217";a="253180809" Received: from mail-wm0-f49.google.com ([74.125.82.49]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 31 Jan 2018 22:14:32 +0100 Received: by mail-wm0-f49.google.com with SMTP id j21so10255077wmh.1 for ; Wed, 31 Jan 2018 13:14:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Zdamn52T2Tuo9qR1ARNGK9Jt6U4yZKxziTGbHF0J64A=; b=jnakZ8nSuwyTVOesA5xX1AzZPbXW/E2/uw5l83h1fmYhKCiYjRSSmS5I4JvreAhJvQ OG5bh6i+y8S4o7hB58YssWRnfobVc3VQ7Wmbv+sOrY/kxMop5aKY5QD6Rge8nqYwCFhF IbU9NSM4yPu5AT/4+xrAE49b/XwdIynrZJF+rkdqhtccEVjPqHtqllatomFRLJvyV6OG I2LmV+2eT0cXu9RAh539aHdaBJB/ip6E1vcZKD5N5JG19P0HJoKqCHaZxt1FKmrVzwmv 8sCxvMcG9La0YsWvRhJDNizxdnyQpdyPplUilH4spwcslVO0kt9uM58HvVxup3H9C6xJ rc3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Zdamn52T2Tuo9qR1ARNGK9Jt6U4yZKxziTGbHF0J64A=; b=fKITZbsokD+tG/vJOsdS0IVJ+LOMJLLrrVb88swnwbxcx4CpMCmp2WvPeAhGm8NItM SIa/77N+z/LuYEQfvA1uIJe9vhsw7wvwzO/vt6ItMqJLAEudy8/R29mE9OAnnrIH9Edn w0OzlHR3wXHU5nuY1U5y4vzppOQ9a9vjOamvAhBREx2lOosPTnSDlZLagJ/vx0q2vLWa YKSUynGyh74fnDaUiGt5scgsanTJb/cnZ9HwnJl83o7V//pznnHE3RaiBvOvl8tUwDfU xRDP8owvyevVNWY9YmP7ssK42Ijg1MteqftPa10mrBQUJIBfo4j6GXOTxFirWtd7YNeQ KY5w== X-Gm-Message-State: AKwxyte2K2og4Vj1wsFefzox9/ZF3NVlnCggAyy4ARvcvAk4OgYbxmZB 1pwSA4ipRT80SzKC01DJi2bSdJ7mSmOMB0D8OKjfWw== X-Google-Smtp-Source: AH8x224DrxGIQMnf5YPxorUbr/Op+FUarkPGK4OdxWzqdIZyuU9V2dl3fq/UAL02vCo1zATQiO6O7uewFCIGSD0mWfI= X-Received: by 10.28.224.137 with SMTP id x131mr26471310wmg.60.1517433271828; Wed, 31 Jan 2018 13:14:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.167.77 with HTTP; Wed, 31 Jan 2018 13:14:31 -0800 (PST) From: Lorenzo Pomili Date: Wed, 31 Jan 2018 22:14:31 +0100 Message-ID: To: caml-list@inria.fr Content-Type: multipart/alternative; boundary="001a1148ed7e23463a056418f764" Subject: [Caml-list] Run time error on exception --001a1148ed7e23463a056418f764 Content-Type: text/plain; charset="UTF-8" Friend of mine, pointed out to me a case in Reason who cause no compile time error but run time error, I had reimplemented similar case in OCaml: exception Generic_exc;; let string_of_string s = string_of_int (int_of_string s) let foo = string_of_string "foo" let fun_exeption x = match x with 0 -> 0 | _ -> raise Generic_exc ;; let bar = string_of_int (fun_exeption 5) both foo and bar don't fail at compile time fail at run time, me and my friend also try to reimplement similar case (the first one with string and int) in Elm, and Elm compiler just say you have to manage exeption, because function can actualy return exeption instead of int. There is a compile params or similar for check this kind of error? is a side effect of have a multi-paradigm? and if is it, how to manage it? I belive I can use OCaml in functional way without just making attention to not use side effect but if use of function like int_of_string can make run time error, I probably approac to OCaml in wrong way, and I wanna understand how to correct it. --001a1148ed7e23463a056418f764 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Friend of mine, pointed out to me a case in Reason who cau= se no compile time error but run time error, I had reimplemented similar ca= se in OCaml:



exception Generic_exc;;

let string_of_st= ring s =3D string_of_int (int_of_string s)

let foo =3D string_of_str= ing "foo"

let fun_exeption x =3D
=C2=A0=C2=A0=C2=A0 mat= ch x with
=C2=A0=C2=A0=C2=A0 0 -> 0
=C2=A0=C2=A0=C2=A0 | _ -> r= aise Generic_exc
;;

let bar =3D string_of_int (fun_exeption 5)


both foo and bar don't fail at compile time fail at run ti= me, me and my friend also try to reimplement similar case (the first one wi= th string and int) in Elm, and Elm compiler just say you have to manage exe= ption, because function can actualy return exeption instead of int.

= There is a compile params or similar for check this kind of error? is a sid= e effect of have a multi-paradigm? and if is it, how to manage it?

I= belive I can use OCaml in functional way without just making attention to = not use side effect but if use of function like int_of_string can make run = time error, I probably approac to OCaml in wrong way, and I wanna understan= d how to correct it.
--001a1148ed7e23463a056418f764--