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 6B5337F9BB for ; Tue, 1 Jul 2014 18:51:13 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of kosmo.zb@gmail.com) identity=pra; client-ip=209.85.215.50; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="kosmo.zb@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of kosmo.zb@gmail.com designates 209.85.215.50 as permitted sender) identity=mailfrom; client-ip=209.85.215.50; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="kosmo.zb@gmail.com"; 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@mail-la0-f50.google.com) identity=helo; client-ip=209.85.215.50; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="postmaster@mail-la0-f50.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArcCAIPmslPRVdcym2dsb2JhbABag19agm6oPgoGboF/l1yBBggWDwEBAQEBBgsLCRQohAMBAQEEEhEEGQE4AQMMAQUFCwYDAQIBAgImAgIhARIBBQEUCAYTCBqIDAMRoFxqiyeFApA9Jw1XhU4RAQUNgR6ERIcJgjSCcYFMAQSYaIF+gUiMKYQhGCmBaoMJPA X-IPAS-Result: ArcCAIPmslPRVdcym2dsb2JhbABag19agm6oPgoGboF/l1yBBggWDwEBAQEBBgsLCRQohAMBAQEEEhEEGQE4AQMMAQUFCwYDAQIBAgImAgIhARIBBQEUCAYTCBqIDAMRoFxqiyeFApA9Jw1XhU4RAQUNgR6ERIcJgjSCcYFMAQSYaIF+gUiMKYQhGCmBaoMJPA X-IronPort-AV: E=Sophos;i="5.01,582,1400018400"; d="scan'208";a="83172850" Received: from mail-la0-f50.google.com ([209.85.215.50]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 01 Jul 2014 18:51:12 +0200 Received: by mail-la0-f50.google.com with SMTP id pv20so6110750lab.37 for ; Tue, 01 Jul 2014 09:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=qMmZ5v0NqEaXCk5K/vacG41+cNerTVRJRPruBhrb74E=; b=YDy5/72Ec/N86dbzuZo+30JoE48Pq+4DenLZRvyrz0EacaArmMQNGqyrIjP0XH+ygG seu8wYPO1M3yRubnD74HhKgPCeeiQAlKFgzuaPAlJ+rwtwU7+5F33WRRfRnVe7HJEtW0 JW+rTx90qUYHEH0UHBWZz7fSEwQFxwsNSQE8sxBnA1qQnFCe0yeszgP+eTy/zAPpQxFs aXhsnAOmERcCAVgXamBeGQ7Rs32l6/y3R08yvqzLc5wgqa9GucPOzhAy8ooyLi7I5KwK 9nOmgzXH+AWJjRbe/NSVCsPoQIUcJfnbJknn8kSxZWhcRYqmvqIO1ZZGG6nmp/4dP6NK bTmg== MIME-Version: 1.0 X-Received: by 10.152.26.37 with SMTP id i5mr8326944lag.17.1404233472143; Tue, 01 Jul 2014 09:51:12 -0700 (PDT) Sender: kosmo.zb@gmail.com Received: by 10.112.157.33 with HTTP; Tue, 1 Jul 2014 09:51:12 -0700 (PDT) In-Reply-To: References: Date: Tue, 1 Jul 2014 17:51:12 +0100 X-Google-Sender-Auth: gYgiU92ejbdMlRkK_9X7EKDxKHg Message-ID: From: David Sheets To: Philippe Veber Cc: caml users Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Fwd: Toplevel and syntax extension. On Tue, Jul 1, 2014 at 5:38 PM, Philippe Veber wrote: > Reposting this question here, just in case. > > ---------- Forwarded message ---------- > From: Philippe Veber > Date: 2014-06-28 21:32 GMT+02:00 > Subject: Toplevel and syntax extension. > To: ocaml_beginners@yahoogroups.com > > > Dear camlers, > > Consider the following script: > > #use "topfind";; > #camlp4o;; > #require "sexplib.syntax";; > > open Sexplib.Std;; > > type t = int with sexp;; > > Saved as script.ml, the simple call: > > ocaml script.ml > > fails while the call: > > cat script.ml | ocaml > > succeeds. Any idea how I could fix the first call? How does the first call fail? A difference between the two is that, in the second, the .ocamlinit file is used. If you are using opam with ocamlfind installed via it, this file will contain your Topdirs setup. You can try: let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () ;; at the top of your script (after hashbang but before directives). Hope this helps, David