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). My father, realizing his son's interest in computers, bought an Atari 800 XL with an upgraded 128K of RAM, which I used through 1993. I wrote school papers in Atari Writer, learned my first spreadsheet (SynCalc), and wrote my first programs in Atari Basic. Dad got me the books Kids & the Atari, by Edward H. Carlson, and Games Ataris Play by Mark James Capella and Michael D. Weinstock. The first of 33 lessons in the Capella/Weinstock book 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). 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 outstring(1,'hello, world')
comment Does anyone know how to output a newline here, not NASE's or Marst's \n?
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). The program module would need to export a string writing function. However, I believe the PDP-11 that Modula was designed on had a teletype output that would need to build a string function similar to Pascal. I don't believe there's 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, but I had nothing to test against:

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;
(* PIM/Medos-2/RT-11 standard library. *)
  FROM InOut IMPORT WriteString, WriteLn;
BEGIN WriteString("hello world!"); WriteLn
END hello.
MODULE hello;
(* ISO/IEC 10514-1:1996 standard library. *)
  FROM STextIO IMPORT WriteString, WriteLn;
BEGIN
  WriteString("hello world!");
  WriteLn
END hello.
(* This is the 1987/88 definition module. *)
DEFINITION hello;
END hello.
 (* Oberon 1987 *)
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.
(* 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 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

[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-2019 David Egan Evans.