hello, world

In 1982, I was introduced to my first computer, an Atari 400, by a teacher, Mr. Ferguson, in Butler, Utah. This began a fascination with computers that led to reading gratis magazines from Radio Shack (no, I never used a TRS-80), and later Byte magazine (thanks Lynn!). My friend Jeremy showed me how to use his Atari 800, including connecting to a neighbor's Software Exchange BBS (later Software Exchange II) using a 300 baud modem (later upgraded to 1200 baud). I began programming in 1984 on an Atari 800 XL with an upgraded 128K of RAM. I wrote school papers in Atari Writer, learned my first spreadsheet (SynCalc), and wrote my first programs in Atari Basic learning from Kids & the Atari[CT83], by Edward H. Carlson. The first of 33 lessons is to print hi, an output program typified by Kernighan and Ritchie's beachhead hello, world (see Exercise 1-1 of The C Programming Language [KP78], and Exercise 1-2 of Software Tools in Pascal [KP81] as given by the echo manual, page 45). Atari Pascal was far better.

After the Atari I owned an original IBM Portable PC 5155 with an upgraded PC DOS 3.3. I used WordPerfect 4.2 on that system, and have learned some of the Modula-2 systems that ran on it. I've worked with many different kinds of systems since. Here are hello, world programs in languages (non-exhaustive) I've learned over the years on many different platforms.

10 REM ATARI BASIC
20 PRINT "HELLO, WORLD"
comment Algol-60 Modified Report and ISO 1538: 1984.
begin
  comment The standard does not allow a newline here, (NASE or Marst has \n).
  outstring(1,'hello, world')
end.
       C     Fortran 66
       WRITE (6,7)
     7 FORMAT(13H HELLO, WORLD)
       STOP
       END
program hello
! Fortran 90 and above.
  print *, "hello, world"
end program hello
program hello(output);
  (* Pascal *)
begin writeln('hello, world')
end.
#!/bin/sh
# Unix Bourne and Posix shell
echo hello, world
# Perl 5.
print "hello, world";
<?php
// PHP
echo "hello, world\n";
?>
# Python 3.
print("hello, world")

Here's my best guess for Modula(-1). I believe the PDP-11 that Modula was designed on had a teletype for output that would need a string function built, similar to Pascal. The report doesn't specify a built-in, other than a device module that would provide a simple character output write to the teletype, but I could have misread the report. This was too fun to not try assuming a message procedure like in CDC Pascal:

module hello;
  (* Using a Pascal-like message function,
     presumed to be exported from the program module. *)
  use message;
begin message("hello world!")
end hello
MODULE hello;
(* Modula-2 PIM/Medos-2/RT-11 standard library. *)
  FROM InOut IMPORT WriteString, WriteLn;
BEGIN WriteString("hello world!"); WriteLn
END hello.
MODULE hello;
(* Modula-2 ISO/IEC 10514-1:1996 standard library. *)
  FROM STextIO IMPORT WriteString, WriteLn;
BEGIN
  WriteString("hello world!");
  WriteLn
END hello.
(* Oberon 1987/88 definition module. *)
DEFINITION hello;
END hello.

 (* Oberon 1987 implementation module*)
IMPLEMENTATION hello; (*DEE 2018-09-08/2019-07-17*)
  IMPORT Texts, Oberon;
  VAR W: Texts.Writer;
  
  PROCEDURE world;
  BEGIN Texts.WriteString(W, "hello, world");
    Texts.WriteLn(W);
    Texts.Append(Oberon.Log, W.buf)
  END world;

BEGIN Texts.OpenWriter(W)
END hello.

This relies on the above DEFINITION:

 (* Oberon 1988 module *)
MODULE hello; (*DEE 2019-07-17*)
  IMPORT Texts, Oberon;
  VAR W: Texts.Writer;
  
  PROCEDURE world;
  BEGIN Texts.WriteString(W, "hello, world");
    Texts.WriteLn(W);
    Texts.Append(Oberon.Log, W.buf)
  END world;

BEGIN Texts.OpenWriter(W)
END hello.
(* Using Reiser's In/Out in Oberon since 1989. *)
MODULE hello; IMPORT Out; (*DEE 2018-09-21*)
BEGIN Out.Open;
  Out.String("hello, world"); Out.Ln
END hello.
(* For Oberon 1989 and Oberon 2013. *)
MODULE hello; (*DEE 2016-08-15*)
  IMPORT Texts, Oberon;
  VAR W: Texts.Writer;
  
  PROCEDURE world*;
  BEGIN Texts.WriteString(W, "hello, world");
    Texts.WriteLn(W);
    Texts.Append(Oberon.Log, W.buf)
  END world;

BEGIN Texts.OpenWriter(W)
END hello.

References

[CT83]
Edward H. Carlson, Paul D. Trap, Kids and the Atari, Datamost, Inc., Reston Publish Company, Inc. (Prentice-Hall), March 1983
[KP81]
B. W. Kernighan, P. J. Plauger, Software Tools in Pascal, Addison-Wesley, 1981
[KR78]
B. W. Kernighan, D. M. Ritchie, The C Programming Language, Second Edition, Prentice Hall Software Series, 1978, 1988

©2017-2020 David Egan Evans.