Deutsch   English   Français   Italiano  
<6778415e$0$708$14726298@news.sunsite.dk>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!news.swapon.de!fu-berlin.de!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Fri, 3 Jan 2025 14:58:22 -0500
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: VMS Pascal article
Newsgroups: comp.os.vms
References: <vl3pi8$2r2sr$1@dont-email.me>
 <67781447$0$711$14726298@news.sunsite.dk> <vl99jl$rf6$1@reader2.panix.com>
 <vl9aln$o72$1@dont-email.me> <vl9bjp$eq3$1@reader2.panix.com>
Content-Language: en-US
From: =?UTF-8?Q?Arne_Vajh=C3=B8j?= <arne@vajhoej.dk>
In-Reply-To: <vl9bjp$eq3$1@reader2.panix.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 105
Message-ID: <6778415e$0$708$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: eeeb38b9.news.sunsite.dk
X-Trace: 1735934302 news.sunsite.dk 708 arne@vajhoej.dk/68.14.27.188:50686
X-Complaints-To: staff@sunsite.dk
Bytes: 3749

On 1/3/2025 1:51 PM, Dan Cross wrote:
> In article <vl9aln$o72$1@dont-email.me>, Arne Vajhøj  <arne@vajhoej.dk> wrote:
>> On 1/3/2025 1:17 PM, Dan Cross wrote:
>>> In article <67781447$0$711$14726298@news.sunsite.dk>,
>>>> And also fixed in the description of VARYING further up.
>>>
>>> You should seriously mention the STRING type, though.
>>
>> I think VARYING OF CHAR is what is used most in VMS Pascal.
> 
> Weird; I can't imagine why.

I never use string (on VMS).

$ search sys$common:[syshlp.examples.pascal]*.pas varying
$ search sys$common:[syshlp.examples.pascal]*.pas "string("

indicate that whoever write VMS Pascal examples also prefer
varying of char over string.

If I were to guess about why, then I believe it is historic
reasons. varying of char has been there since like forever.
string was added with ISO Pascal support later.

>                             Regardless, it may be worthwhile to
> at least mention it, since you state explicitly that there are
> three types for representing textual, string-like data, but
> VSI's documentation makes it clear that there are actually four.

Good point.

I have updated.

>>> Also, it's a bit of a bummer that you didn't mention nested
>>> functions/procedures, which are among the cooler aspects of the
>>> language:
>>>
>>> $ type foo.pas
>>> (* foo *)
>>> program foo(output);
>>> procedure hello;
>>>       procedure world(var who: String);
>>>           function punct: char;
>>>           begin
>>>               punct := '!'
>>>           end;
>>>       begin
>>>           who := 'World' + punct
>>>       end;
>>> var
>>>       who: String (10);
>>> begin
>>>       world(who);
>>>       writeln('Hello, ', who)
>>> end;
>>> begin
>>>       hello
>>> end.
>>
>> There is already an example. fac is inside testfac.
>>
>> I will add a note about it.
> 
> Ah, I see it now; the lack of indentation makes it hard to spot.

I don't indent them.

With the blank lines I put in then I feel that indenting
nested procedures/functions would make it too much space.

But it is a close decision. In C# I do not use blank lines
and I do indent local methods.

Same code:

using System;

public class Program
{
     public static void TestFac()
     {
         int Fac(int n)
         {
             if(n < 2)
             {
                 return 1;
             }
             else
             {
                 return n * Fac(n - 1);
             }
         }
         for(int i = 0; i < 6; i++)
         {
             Console.WriteLine("fac({0})={1}", i, Fac(i));
         }
     }
     public static void Main(string[] args)
     {
         TestFac();
     }
}

Arne