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 E9A2F7FACB for ; Sun, 14 Sep 2014 11:15:04 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.219.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.219.45 as permitted sender) identity=mailfrom; client-ip=209.85.219.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@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-oa0-f45.google.com) identity=helo; client-ip=209.85.219.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-oa0-f45.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4BACRcFVTRVdstm2dsb2JhbABgDoNSVwSCeLIahDaOEYFrh04BfAgWEAEBAQEBBgsLCRQqhAMBAQEDARIRBBkBGxILAQMBCwYDAgQHAwoNHQICIgERAQUBChIGExIQiAcBAwkIDYVOkCprizCBcoMQiDoKGScDCmaGDwERAQUOjzsEB4J4gVMBBIUNBY0+gzSHBIFfjSWESRgpgnkfHoEZQjsvAYJJAQEB X-IPAS-Result: Ap4BACRcFVTRVdstm2dsb2JhbABgDoNSVwSCeLIahDaOEYFrh04BfAgWEAEBAQEBBgsLCRQqhAMBAQEDARIRBBkBGxILAQMBCwYDAgQHAwoNHQICIgERAQUBChIGExIQiAcBAwkIDYVOkCprizCBcoMQiDoKGScDCmaGDwERAQUOjzsEB4J4gVMBBIUNBY0+gzSHBIFfjSWESRgpgnkfHoEZQjsvAYJJAQEB X-IronPort-AV: E=Sophos;i="5.04,520,1406584800"; d="scan'208";a="79125783" Received: from mail-oa0-f45.google.com ([209.85.219.45]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 14 Sep 2014 11:15:03 +0200 Received: by mail-oa0-f45.google.com with SMTP id m1so1742299oag.18 for ; Sun, 14 Sep 2014 02:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=9T9iNK5pbLd/yS9IidZ89u/KiIIdGudOZ/qf1fp7OIU=; b=SLFhJPtmTmmfK153hTDpmYmiIE5zSENwMe1ROMQXsn/j9i7/jjV0B7IzfeK06xN1z3 R6zRrvlGRWXSn7Tv7A4TTRibk2YZrYf3Kt2yQvxXjymemkbLVyiyTbhh2W7F8Kht2Lnz PuO8G6PziKVzmdPia9Badk9AeDxgq2iAx8scPyqWV3JACnU1XbMVV1gQGy/MvWDiEhup BCSXuPjbkaSiL/TD010zIJcNBr67Hag5fEJ7M3QMgKWaBNX6vAsfBxLDvlbXVvQl4itN i9xHqO2YLUAR/XVOAsp8PjbLfD2FaW7Iwmdt2V5NH9ojiLTu0U6HuDOkjSeGNlKY1WOO Ambw== X-Received: by 10.182.226.202 with SMTP id ru10mr389962obc.77.1410686102567; Sun, 14 Sep 2014 02:15:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.141.165 with HTTP; Sun, 14 Sep 2014 02:14:22 -0700 (PDT) In-Reply-To: References: <20140914004715.Horde.0vNRgNUsRsqsjnX3ZDjGPQ9@webmail.in-berlin.de> From: Gabriel Scherer Date: Sun, 14 Sep 2014 11:14:22 +0200 Message-ID: To: Benjamin Greenman Cc: Oliver Bandel , OCaml mailing-list Content-Type: multipart/alternative; boundary=001a11c32efa088f1f050302f4fc Subject: Re: [Caml-list] With String.sub I need to catch "Bytes.sub" exception --001a11c32efa088f1f050302f4fc Content-Type: text/plain; charset=UTF-8 Even if it's not technically a regression against the specification as per Benjamin's message above, breaking working code is still not very good. Could you please report this on the OCaml bugtracker? http://caml.inria.fr/mantis/ On Sun, Sep 14, 2014 at 12:53 AM, Benjamin Greenman wrote: > Why do you match on the error string? String.sub is only documented to > raise "Invalid_argument _". > > http://caml.inria.fr/pub/docs/manual-ocaml/libref/String.html > > On Sat, Sep 13, 2014 at 6:47 PM, Oliver Bandel > wrote: > >> Hello, >> >> is this a known bug? >> >> Needed to change code from >> >> with Invalid_argument("Strings.sub") >> to >> with Invalid_argument("Bytes.sub") >> >> The code now looks like this and then works again: >> >> >> try >> if parser_url_len > 0 && parser_url = String.sub url >> 0 parser_url_len then parser_name else aux tl >> with Invalid_argument("Bytes.sub") -> aux tl (* this >> happens if url is shorter than parser_url *) >> >> >> Ciao, >> Oliver >> >> >> -- >> 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 >> > > --001a11c32efa088f1f050302f4fc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Even if it's not technically a regression against the = specification as per Benjamin's message above, breaking working code is= still not very good. Could you please report this on the OCaml bugtracker?=


On Sun, Sep 14, 2014 at 12:53 AM, Benjamin Greenma= n <blg59@cornell.edu> wrote:
Why do you match on the error string? String.sub is onl= y documented to raise "Invalid_argument _".

http://caml.inria.fr/pub/docs/manual-ocaml/libref/String.htm= l

On Sat, Sep 13, 2014 at 6:47 PM= , Oliver Bandel <oliver@first.in-berlin.de> wrote:
Hello,

is this a known bug?

Needed to change code from

=C2=A0 =C2=A0with Invalid_argument("Strings.sub")
to
=C2=A0 =C2=A0with Invalid_argument("Bytes.sub")

The code now looks like this and then works again:


=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 try
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if pa= rser_url_len > 0 && parser_url =3D String.sub url 0 parser_url_l= en then parser_name else aux tl
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 with Invalid= _argument("Bytes.sub") -> aux tl (* this happens if url is sho= rter than parser_url *)


Ciao,
=C2=A0 =C2=A0Oliver


--
Caml-list mailing list.=C2=A0 Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners<= /a>
Bug reports:
http://caml.inria.fr/bin/caml-bugs


--001a11c32efa088f1f050302f4fc--