Hello World in all programming languages available on Haiku

Don’t think it was ported to Haiku though… :wink:

Nothing that mainstream

Console.WriteLine(“Hello, World!”);

module Main exposing (..)
import Browser
import Html exposing (Html, div, h2, text)

main = div 
 [ h2 
 [ text “Hello, World!” ]]

It isn’t to be found in HaikuDepot, so I think I may exempt it from the contest and reveal that it’s Elm, compiled by Guida. In fact I believe it downloaded elm components when I compiled this example. Elm is modeled after Haskell, and compiles to JavaScript.

Guida is an Elm compiler developed by someone else - Décio Ferreira here in Portugal I believe - for reasons I believe having mostly to do with governance. But for Haiku, the critical thing is that it’s implemented as a Node application that can run on Haiku, not a Haskell binary that can’t. (The ghs Haskell compiler has been built on Haiku in the past, but as far as I know no one has managed it recently.)

So if you manage to install everything, the above code can be compiled to a .html file full of JavaScript that manages to output its little phrase.

2 Likes

There are some JavaScript-related tools like CloJureScript and CloJure. Haikuports has a Lua port so we can possible use Fennel.

This can get into creative ways or simpler ways to do the same task:

Figlet:

figlet Hello, world!

versus languages like COBOL, RPG, Ada95, Mercury, or OPS5.

OPS5:

(object-class request ^action)

(startup
   (strategy MEA)
   (make request ^action hello)
)

(rule hello
   (request ^action hello)
   (write |Hello World!| (crlf))
)
2 Likes

a few obfuscations …

tr G-t F-s<<<Ifmmp\ Xpsme

dc<<<"8 9*P101P108P108P111P4 8*P81 6+P111P114P108P100P33P10P"

echo "¡p|ɹoM o||ǝH"

#include <stdio.h>
#define o stdout
#define p fputs
int main(_){int*I=&_,_I=2113,l1=3271;_=14557;_I*=503;_<<=3;_*='=';_I<<=0==0;_I=7*'Y'*853<<2;
p(I,o);I=&_I;p(I,o);I=&_;

    _+= l1*11*11;

_I += 0xF5<<8;p(I,o);I=&_I;p(I,o);}

Well, I’m not quite sure if this counts, as it runs on an emulator that runs on Haiku, but here it is:

chrout   = $ffd2
         *= $0801

         ldx #$00
loop     lda string,x
         beq done
         jsr chrout
         inx
         jmp loop
done     rts

string   .null "Hello World!"

Is this 6502 Assembly Language

Yes, but it will only run on a specific computer (or emulator) that has the 6502 CPU (needs minor modifications to run on another machine/emulator). And it’s not just any Assembly, it’s a specific Assembly implementation.

That’s actually a cool fact what app on haiku runs it? I maybe wanna try it out

Needs the Vice emulator (the SDL2 version of it runs on Haiku) emulating the Commodore 64 computer, which in turn runs the Turbo Macro Pro assembler.

1 Like

How did you get it to build? It stops for me because of USBSID. The Haikuports version (which is older) just dies with an ld problem.

Honestly, I don’t remember. I read the corresponding threads here, tried to build, but I think in the end I used a precompiled package. And even then it has issues.

1 Like

my personal favorite:

"Hello, World!"

Works in Lisp.

3 Likes

You’ll probably hate me for this …

10 PRINT "Hello World"

… it also needs …

RUN

(I’m on my way out of the door, but thought I’d just add it)

2 Likes

No, not at all. Quite on the contrary. BASIC, in the form of basica on IBM DOS and gwbasic on MS DOS, was my first programming language as a kid in the late 80ies and I’ve got very nostalgic feelings about it. Of course I wouldn’t want to write anything beyond a hello world on it today, but I loved it back then. Even wrote a simple space invaders game with it, using CGA graphics. Fun times back in the days when it wasn’t universally regarded as cool to be a nerd :slight_smile:

1 Like

This one reminds me of my first steps in BASIC on a Tandy TRS Model 1 in my youth…

3 Likes

… running at 0.005 FPS, I guess :laughing:

Basic was… very basic back then. and ridiculously slow (to be expected, as it was interpreted). But I’m glad my C64 had probably the worst implementation of the language, ever. That was the reason I learned Assembly.

2 Likes

No hate from here, but which BASIC dialect were you thinking of? Yab won’t need a RUN command, just hit ENTER twice.

The more basic BASICS like bwbasic that may need a RUN are not officially part of Haiku, but I have a few on my site.

1 Like

This particular one is available through FUSE (Free Unix Spectrum Emulator).

-Some emulators (not FUSE) also allows you to emulate ZX80 and ZX81; which would be the exact same for the ‘PRINT’ example). Though ZX-Basic was slow (often quicker than the competitors, there was a Basic-compiler called MCoder2, which made basic programs blazing fast, so we had the ability to make decent speed programs on the Speccy back then.