From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FROM_ADDR_WS autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 8 Jul 91 15:49:28 GMT From: aio!qbe!dean@eos.arc.nasa.gov (Jack Dean (713) 283-4008) Subject: Re: Sliding Semantics? Message-ID: <1991Jul8.154928.24379@aio.jsc.nasa.gov> List-Id: In article <2871efdf.5c45@polyslo.CalPoly.EDU>, nwebre@polyslo.CalPoly.EDU (Nei l Webre) writes: |> |> There are a couple of workarounds. The best we've been able to invent |> has been using type conversions. The substring statement, for instance, |> becomes |> |> declare |> type anchor is new string(1..len); |> begin |> s3 := (len, string(anchor(s2.text(posn .. posn + len - 1)))); |> end; |> |> That "slides" the index range of the result to be from 1 to some value. |> Very interesting problem. I was unable to come a significantly better solution. One question I do have though, is there any advantage to using a subtype declaration for anchor, i.e. declare subtype anchor is string(1..len); begin s3 := (len, anchor(s2.text(posn .. posn + len - 1))); end; Will the compiler generate less code in this case since there is no type conversion? This works as desired on the Rational. Does it do the same thing on other machines / other Ada compilers? -- ============================================================================ Jack Dean | McDonnell Douglas Space Systems Co. | Houston, Tx. | dean@sweetpea.jsc.nasa.gov | ============================================================================