Recent activity

Re: Modules and vendor directory 16 days ago

From John Gabriele to ~sircmpwn/hare-users

On Sat, Sep 9, 2023, at 10:20 AM, Blain Smith wrote:
> I've been using a few different modules in a program recently and I 
> understand how modules work and have read 
> https://harelang.org/tutorials/libraries/ a few times, but I think {snip}

A big off-topic, but where is that libraries tutorial linked from? I can't find a link to it at https://harelang.org/tutorial/ .

Re: understanding how to think about tagged union error types a month ago

From John Gabriele to ~sircmpwn/hare-users

On Sun, Aug 20, 2023, at 3:18 PM, Sebastian wrote:
> On Sun Aug 20, 2023 at 2:32 PM EDT, John Gabriele wrote:
>>
>> What does it mean for a value to be of type baz,
>> but have a tag of type foo? I think I'm misunderstanding
>> something basic about tagged unions here.
>
> Starting again with a more basic concept, that being regular unions. If
> you're already familiar with these then feel free to skip over this:
> {snip}

Sebastian,

Thanks so much for for the review of the basic concepts. It's been

Re: understanding how to think about tagged union error types a month ago

From John Gabriele to ~sircmpwn/hare-users

Thanks so much, Sebastian! I'm still digesting and
rereading your response (and relevant parts of the
tutorial), and have a few questions.

In your first example, in the comment:

~~~
case baz =>
	    // Reached when baz is returned from f(). Note that baz
		// is a tagged union which contains foo. But if foo is
		// returned, this case *won't* be run, since the return
		// type is just plain foo, not a foo within a baz. If
		// the function returned `foo: baz`, then this case
		// would run, and you'd be able to match on the baz

understanding how to think about tagged union error types a month ago

From John Gabriele to ~sircmpwn/hare-users

In the tutorial, in the section about error handling
https://harelang.org/tutorials/introduction/#a-few-words-about-error-handling
I see that os::create may return an fs::error. The example code only has a case
for errors::noaccess, and then a case for fs::error.

I'm trying to better understand how to think about types of errors. Here's
the doc for fs::error:

~~~
$ haredoc fs::error
// All possible fs error types.
type error = !(errors::noentry | errors::noaccess | errors::exists |
        errors::busy | errors::invalid | errors::unsupported |
        wrongtype | cannotrename | io::error);

Re: [PATCH harelang.org] Fix typo (s/x/y/), and clarify remainder of sentence. a month ago

From John Gabriele to ~sircmpwn/hare-dev

Egads. Sorry, my editor is set to delete trailing whitespace.

Re: replace type assertion with match? a month ago

From John Gabriele to ~sircmpwn/hare-users

On Sat, Aug 12, 2023, at 6:23 PM, Ember Sawady wrote:
> mind updating my name in your contacts? i think fastmail must've been a
> bit overzealous in remembering stuff during some brief interactions we
> had on hare-dev a bit over a year ago and it's kinda distracting lol

Ah, thanks for the correction. Updated.

> On Sat Aug 12, 2023 at 10:11 PM UTC, John Gabriele wrote:
>> Looking back at the examples I posted, I see that I kept accidentally
>> writing `match (bufio::scanline(os::stdin)!) { ...`  (with the `!` after the
>> function call that I'm matching on). Seems like this would be at odds with
>> (or defeat the purpose of) the rest of the match body, no?
>
> no, match (bufio::scanline(os::stdin)!) is correct in that context - the

Re: replace type assertion with match? a month ago

From John Gabriele to ~sircmpwn/hare-users

Looking back at the examples I posted, I see that I kept accidentally
writing `match (bufio::scanline(os::stdin)!) { ...`  (with the `!` after the
function call that I'm matching on). Seems like this would be at odds with
(or defeat the purpose of) the rest of the match body, no? If that's the
case, should the compiler issue a warning about it?


On Mon, Aug 7, 2023, at 2:02 PM, Mike Eichler wrote:
> Thank you very much for explaining this to me - removing the curly 
> braces works!
>
> Noted about the space between the ":" and the type.
>
>

Re: replace type assertion with match? 4 months ago

From John Gabriele to ~sircmpwn/hare-users

On Sun, May 14, 2023, at 3:04 PM, John Gabriele wrote:
> On Sun, May 14, 2023, at 2:36 PM, Ember Sawady wrote:
>> match (bufio::scanline(os::stdin)) {
>> case io::EOF =>
>> 	fmt::println("reached eof with no input")!;
>> case let name: []u8 =>
>> 	yield name;
>> };
>>
>> there's a ticket for allowing zero-sized bindings, but there's also not
>> really a usecase for them in this context
>
> Ah, because io::EOF is of type void, this would make it a zero-sized
> binding. (Also, I see that there's no additional info about an EOF that

Re: replace type assertion with match? 4 months ago

From John Gabriele to ~sircmpwn/hare-users

On Sun, May 14, 2023, at 2:36 PM, Ember Sawady wrote:
> match (bufio::scanline(os::stdin)) {
> case io::EOF =>
> 	fmt::println("reached eof with no input")!;
> case let name: []u8 =>
> 	yield name;
> };
>
> there's a ticket for allowing zero-sized bindings, but there's also not
> really a usecase for them in this context

Ah, because io::EOF is of type void, this would make it a zero-sized
binding. (Also, I see that there's no additional info about an EOF that
you'd need.)

replace type assertion with match? 4 months ago

From John Gabriele to ~sircmpwn/hare-users

In the tutorial, in the example with bufio::scanline
https://harelang.org/tutorials/introduction/#a-closer-look-at-bufioscanline ,
there's a type assertion (`as` operator) after the call to bufio::scanline.

Is this type assertion an alternative to using a `match` and trying to
match against the io::EOF return val?

How could I modify that sample code to match on the return value of
bufio::scanline? Here's my attempt:

~~~hare
use bufio;
use fmt;
use os;