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 6F5F07FAED for ; Mon, 24 Nov 2014 18:42:32 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of kennethadammiller@gmail.com) identity=pra; client-ip=209.85.214.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="kennethadammiller@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of kennethadammiller@gmail.com designates 209.85.214.172 as permitted sender) identity=mailfrom; client-ip=209.85.214.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="kennethadammiller@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-ob0-f172.google.com) identity=helo; client-ip=209.85.214.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="postmaster@mail-ob0-f172.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvIBAC5tc1TRVdasnGdsb2JhbABbhDwEgwLQHAcWAQEBAQERAQEBAQEGDQkJFC6EGxEdARseAxIJAQY3AiQBEQEFASI1iAkBAxKqUIMlPTGLO4FygxGJbQoZJw1ohgQBBQ6TPA8yEoFDBYwlklyNJYd6GCmFVSowgksBAQE X-IPAS-Result: AvIBAC5tc1TRVdasnGdsb2JhbABbhDwEgwLQHAcWAQEBAQERAQEBAQEGDQkJFC6EGxEdARseAxIJAQY3AiQBEQEFASI1iAkBAxKqUIMlPTGLO4FygxGJbQoZJw1ohgQBBQ6TPA8yEoFDBYwlklyNJYd6GCmFVSowgksBAQE X-IronPort-AV: E=Sophos;i="5.07,450,1413237600"; d="scan'208";a="109311419" Received: from mail-ob0-f172.google.com ([209.85.214.172]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 24 Nov 2014 18:42:31 +0100 Received: by mail-ob0-f172.google.com with SMTP id wn1so7538489obc.3 for ; Mon, 24 Nov 2014 09:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=9sqh8paZp90izGFw6R/T8nZc3t4vJEZcU572HvSFgkM=; b=yitxujM8poFTVntxniwOUZw8yzyVjq53+3yUV6AMufiIcUQfMsHpdW5ZZ45tQHsYum SfNXvhtX28RPyO8SjhORgyX3GrH+2eLyPYKr9UuxMZR4INoT1r1bNZLutbic47UL1BYD AM/vS72Lp7II0gpJctZ5MSD8leOvFWTOVsFmI7N7BOeY9GULjF3lpQBIQGqzm1p8ytLw TUbQzSk6aFr51PR2l9mZieEDQ6xyJUNPRc+hGY5DyzDMX8RLDVv30uIbLogBRz36IOAS 9H7Hl8xOa33c3tTSnLPfP92txbT94eeZbGaEMc/E7V8S54p1IXaETzyZ36wn//Rg1OEX H1Xg== MIME-Version: 1.0 X-Received: by 10.182.109.129 with SMTP id hs1mr12170273obb.74.1416850950607; Mon, 24 Nov 2014 09:42:30 -0800 (PST) Received: by 10.182.197.1 with HTTP; Mon, 24 Nov 2014 09:42:30 -0800 (PST) Date: Mon, 24 Nov 2014 12:42:30 -0500 Message-ID: From: Kenneth Adam Miller To: caml users Content-Type: multipart/alternative; boundary=001a11c309809c5b7305089e5196 Subject: [Caml-list] complications with Arg.parse_argv --001a11c309809c5b7305089e5196 Content-Type: text/plain; charset=UTF-8 So, I'm using a library that calls Arg.parse to build up it's inputs in another data structure. I don't want to rewrite any code, and I'm consuming the library in a different way than how the binary consumes it, which is just to feed it input from the command line. Not wanting to replicate code in two locations, I chose to use Arg.parse_argv, and supplied it with an array that would normally be on the command line. For some reason, supplying the exact same speclist as what was used in the original statement that works as a command line tool doesn't result in the parameters being parsed. command line tool: Arg.parse speclist anon usage; get_program () (* consumes the mutable list that speclist modified *) (* speclist modifies a mutable list used to hold arguments *) my code that consumes speclist as a library: Arg.parse_argv custom_arguments speclist anon usage get_program () (* exact same function as above, exact same variables to Arg.parse* *) For some reason, Arg.parse_argv seems to complete, but when get_program proceeds, it sees the mutable argument list as being empty. Why? --001a11c309809c5b7305089e5196 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
So, I'm using a library that calls Arg.parse to build = up it's inputs in another data structure. I don't want to rewrite a= ny code, and I'm consuming the library in a different way than how the = binary consumes it, which is just to feed it input from the command line.= =C2=A0

Not wanting to replicate code in two locations, I= chose to use Arg.parse_argv, and supplied it with an array that would norm= ally be on the command line. For some reason, supplying the exact same spec= list as what was used in the original statement that works as a command lin= e tool doesn't result in the parameters being parsed.

command line tool:
Arg.parse speclist anon usage;
get_program () (* consumes the mutable list that speclist modified *= )

(* speclist modifies a mutable list used to hold= arguments *)

my code that consumes speclist as a = library:

Arg.parse_argv custom_arguments speclist = anon usage
get_program () (* exact same function as above, exact = same variables to Arg.parse* *)

For some reason, A= rg.parse_argv seems to complete, but when get_program proceeds, it sees the= mutable argument list as being empty. Why?
--001a11c309809c5b7305089e5196--