hello, world

In 1982, I was introduced to my first computer, an Atari 400, by my 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. A neighbor showed me how to use his Atari 800, including connecting to a neighbor's Software Exchange BBS using a 300 baud modem. I continued with the 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 [KR78], and Exercise 1-2 of Software Tools in Pascal[KP81] as given by the echo manual, page 45).

After the Atari I owned an original IBM Portable PC (the 5155, an XT) with an upgraded PC DOS 3.3 from its original 2.10. I used WordPerfect 4.2 on that system. I used that system for some time, replacing it with MS-DOS which I continued using until 2002 on MS-DOS 6.22. By that point I was also running Windows NT (Back Office) and Slackware 96, (I couldn't stand 9x). I used NT through Windows 2000, where I abandoned it for Slackware and Coredistro. Today I run my own GNU/Linux distribution, Slackware64, a Windows 10 Pro HP Elitebook, and macOS for work. 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"
:10 REM Pittman's Tiny Basic
:20 PRINT "hello, world"
:30 END
:run
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-2023 David Egan Evans.