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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 9AD247F8F2 for ; Thu, 22 May 2014 19:22:38 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of martin.jambon@ens-lyon.org) identity=pra; client-ip=66.111.4.27; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="martin.jambon@ens-lyon.org"; x-sender="martin.jambon@ens-lyon.org"; x-conformance=sidf_compatible Received-SPF: Neutral (mail2-smtp-roc.national.inria.fr: domain of martin.jambon@ens-lyon.org does not assert whether or not 66.111.4.27 is permitted sender) identity=mailfrom; client-ip=66.111.4.27; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="martin.jambon@ens-lyon.org"; x-sender="martin.jambon@ens-lyon.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@out3-smtp.messagingengine.com) identity=helo; client-ip=66.111.4.27; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="martin.jambon@ens-lyon.org"; x-sender="postmaster@out3-smtp.messagingengine.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: As8BAIgxflNCbwQbnGdsb2JhbABZg1mDQak5gQeXAQGBDRYOAQEBAQEGDQkJFCiCJQEBBAEjDwEFCC4KAQEECwsOCgICBQQSCAMCAgkDAgECAQ8kAREGDQEFAgEBDogbAwkIDbBPd4UFmXQDCoYXEQaBKosPgSg6MweCdYFLAYRhBYU+jVuDMoUVGYQsgh2JSk0B X-IPAS-Result: As8BAIgxflNCbwQbnGdsb2JhbABZg1mDQak5gQeXAQGBDRYOAQEBAQEGDQkJFCiCJQEBBAEjDwEFCC4KAQEECwsOCgICBQQSCAMCAgkDAgECAQ8kAREGDQEFAgEBDogbAwkIDbBPd4UFmXQDCoYXEQaBKosPgSg6MweCdYFLAYRhBYU+jVuDMoUVGYQsgh2JSk0B X-IronPort-AV: E=Sophos;i="4.98,888,1392159600"; d="scan'208";a="75372536" Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 May 2014 19:22:37 +0200 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id D576C20ED8; Thu, 22 May 2014 13:22:35 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Thu, 22 May 2014 13:22:35 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=n/vZZPLlk17Otc4cmDQC4+ 48cYY=; b=BH/ELXXcro2NXSwYLEKicejiLZJa3jQuTaGmwoFWJFIUixs+u6X7u/ 8Sm7B3/2zlqj7yH9feNfXhpbrKbqczCjEwZP4qeGp5lt3mEQG1QrTrYtYjEN4oNM NVj2eAZHFr7Vzq5cH7wBR2UAR6ejYzRgVFFpJVqxTkxwAyl+dfJok= X-Sasl-enc: FGaHqwG81PpY+MjzL8KsGku+GPCtfH+IM+ZY6Ar/oxR0 1400779355 Received: from [172.16.71.123] (unknown [50.193.45.145]) by mail.messagingengine.com (Postfix) with ESMTPA id 23E38680114; Thu, 22 May 2014 13:22:35 -0400 (EDT) Message-ID: <537E325A.4030304@ens-lyon.org> Date: Thu, 22 May 2014 10:22:34 -0700 From: Martin Jambon User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Ben Millwood CC: David House , caml users , Ollie Frolovs References: <762DAB52-9D2E-4002-80B0-526258DD7856@my.bristol.ac.uk> <2ABC1954-90FF-41CF-AB18-0C228A51CB8E@my.bristol.ac.uk> <537CD70F.9010503@ens-lyon.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] Random.self_init in Jane Street Core On Thu 22 May 2014 02:01:01 AM PDT, Ben Millwood wrote: > On 21 May 2014 17:40, Martin Jambon > wrote: > > On Wed 21 May 2014 05:28:00 AM PDT, David House wrote: > > Relatedly, one should be careful using the [ignore] function. > Always > give its argument a type signature. E.g. if you do this: > > ignore (my_function foo); > > Then this will start silently not calling [my_function] whenever > someone adds a second argument. You should instead use: > > ignore (my_function foo : Foo.t); > > > I think it used to be a problem but it no longer is. Recent > versions of OCaml give a warning when passing a function, so > there's no need for a type annotation: > > $ ocaml > OCaml version 4.01.0 > > # ignore print_endline;; > Warning 5: this function application is partial, > maybe some arguments are missing. > - : unit = () > > > You're right that this warning exists and mitigates the problem > somewhat, but it doesn't save you from the scenario where, say, a > function changes from returning unit and throwing exceptions in the > case of error to returning some error value, or vice versa. It seems > just generally if the return type of a function you use changes that's > probably something you'd want noise made about. I can see it's a problem when the function that throws an exception does not return unit. However if the original function returns unit, we don't use ignore in the first place and we get a warning if the return type changes. If the original function returns something but then switches to unit + exception, I guess the compiler could warn against that too: Warning X: this 'ignore' is useless > On 21 May 2014 13:25, Ollie Frolovs > > >> wrote: > > oh dear! i think i know what happened. self_init has never > been > called in the first place! it requires a unit argument > which i did > not give it, so the “alias” to Random.self_init was > assigned to > nothing, so to speak, instead of calling the function. > > Many thanks, Dmitry! I’ve amended that line to let () = > Random.self_init () and it works. > > On 21 May 2014, at 13:18, Dmitry Grebeniuk > > >> wrote: > > > Hello. > > > >> let _ = Random.self_init > > > > That's why I almost never use "let _ = ...", or > > constrain "_" to some type when I use it. > > Try to replace it with "let () = ..." and follow compiler > > errors. Or with "let (_ : unit) = ...". > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/__arc/caml-list > > Beginner's list: > http://groups.yahoo.com/group/__ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-__bugs > > > > > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/__arc/caml-list > > Beginner's list: http://groups.yahoo.com/group/__ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-__bugs > > >