1
13
Hare 0.24.2 released (harelang.org)
submitted 3 months ago by neme@lemm.ee to c/hare@programming.dev
2
7
submitted 4 months ago by modev@programming.dev to c/hare@programming.dev
3
8
submitted 7 months ago by mac@programming.dev to c/hare@programming.dev
4
6
submitted 8 months ago by modev@programming.dev to c/hare@programming.dev

There is a port hare-lang, but as Drew DeVault answered my question "Just want to know - is this port official hare distribution and is it updated?":

"We do not maintain downstream packages. It's official if that's an official source for your distro."

So I found a good manual on how to do this from repos:

There are 4 total things you need to install to get Hare working on FreeBSD, 2 pre-requisites and 2 Hare packages. It's possible that you already have the pre-requisites setup, in which case you can skip the step, but they are uncommon enough that I'm including them here.

I did the installation in a fresh jail for isolation, but of course you can install where ever you like, the steps are the same.

Initial setup

First you'll need git:

pkg install git

Since we're installing from source, we need somewhere to put the source, so I created /usr/local/src

mkdir -p /usr/local/src
cd /usr/local/src

Now we can start building packages.

Pre-requisites

QBE

QBE is a compiler backend used by Hare.

First clone the repository:

git clone git://c9x.me/qbe.git
cd qbe

Then build and install:

make
make install
cd ..

scdoc

scdoc is a man page generator, first clone:

git clone https://git.sr.ht/~sircmpwn/scdoc
cd scdoc

scdoc uses syntax in its Makefile not supported by BSD make so you'll need gmake:

pkg install gmake

Then use gmake to build and install:

gmake
gmake install
cd ..

Hare

Now with the prereqs you can install Hare itself, first the bootstrap compiler:

git clone https://git.sr.ht/~sircmpwn/harec
cd harec

Copy the FreeBSD config from the configs folder:

cp configs/freebsd.mk config.mk

Then build and install:

make
make install
cd ..

Last up is the main package:

git clone https://git.sr.ht/~sircmpwn/hare
cd hare

Like last time, copy over the FreeBSD build config:

cp configs/freebsd.mk config.mk

Before building, Hare depends on as, an assembler, which you can get from binutils:

pkg install binutils

And with that you should be able to build and install:

make
make install
cd ..

Hello world

First, let's do a simple Hello world.

echo 'use fmt;

export fn main() void = {
	fmt::println("Hello world!")!;
};' > main.ha

Which you can now run with the hare run command:

hare run main.ha

It will take a second the first time, but you should then see the print out. To build to an executable use the build command instead:

hare build -o helloworld main.ha
./helloworld

And that's it, I hope this is helpful for FreeBSD users out there.

5
5
submitted 8 months ago* (last edited 8 months ago) by modev@programming.dev to c/hare@programming.dev

What do you think about Hare? I think it takes best from different languages, intentionally or not...

It is simple like C, but safer, and at the same time allows you ~~to shoot yourself in the foot~~ to take control and make mistakes if you want.

Example from this blog post two years ago:

fn io::write(s: *stream, buf: const []u8) (size | io::error);

// ...

sum += match (io::write(s, buf)) {
case let err: io::error =>
	match (err) {
	case unsupported =>
		abort("Expected write to be supported");
	case =>
		return err;
	};
case let n: size =>
	process(buf[..n]);
	yield n;
};

Expression-based syntax and match statements remind me of Rust, but it implemented simpler without options...

Maybe you already used Hare in your project. Interesting to read your feedback...

Do you like it? Why?
Dislike? Why?

6
2
submitted 8 months ago* (last edited 8 months ago) by modev@programming.dev to c/hare@programming.dev

Interview with the creator of the Hare programming language.

7
5
submitted 8 months ago by mac@programming.dev to c/hare@programming.dev
8
6
submitted 8 months ago by mac@programming.dev to c/hare@programming.dev
9
5
submitted 9 months ago by mac@programming.dev to c/hare@programming.dev
10
6
submitted 9 months ago by mac@programming.dev to c/hare@programming.dev

Hare

47 readers
1 users here now

Welcome to the Hare community!

Hare is a systems programming language designed to be simple, stable, and robust. Hare uses a static type system, manual memory management, and a minimal runtime. It is well-suited to writing operating systems, system tools, compilers, networking software, and other low-level, high-performance tasks.

© Drew DeVault

🌐 https://harelang.org

founded 9 months ago
MODERATORS