~sircmpwn/hare-users

3 3

Modules and vendor directory

Details
Message ID
<FH2Q0S.TQNC6GD5C2SE3@gmail.com>
DKIM signature
pass
Download raw message
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 
there is some awkwardness when using git submodules or subtrees to pull 
in modules to the `./vendor` directory. When you do either `git 
submodule` or `git subtree` into a `./vendor` directory you end up with 
an additional folder you then need to modify your `HAREPATH` to look in.

Using `git subtree -P vendor/hare-irc/ pull 
https://git.sr.ht/~sircmpwn/hare-irc master` you end up with:

./cmd/main.ha
./vendor/hare-irc/net/irc/*

Then attempting to use it yields "net::irc: Module not found" even with 
HAREPATH containing "./vendor" to look in based on the tutorial link.

use net::irc;

export fn main() void = {...};

You can't even `use hare-irc::net::irc;` since the "-" is invalid. So 
recommending git submodules or git subtrees leads to some awkward 
experiences. You can obviously circumvent this and clone the repo 
directly and use the `make && sudo make install` method if the author 
provides it, but that might not always be available for whatever reason.

You ultimately would need to do:

 > HAREPATH="$HAREPATH:./vendor/hare-irc" hare build ./cmd/main.ha

I wonder if there is a better way to handle modules that end up in a 
`./vendor` folder to make the experience a bit cleaner or update the 
tutorial to bring attention to this fact that devs will need to specify 
additional paths in `HAREPATH` at compile time to account for the 
additional folder when using `git submodule` and `git subtree`.
Details
Message ID
<CVEIFJLSEJ0X.3Q7CMAH4JN1SF@monch>
In-Reply-To
<FH2Q0S.TQNC6GD5C2SE3@gmail.com> (view parent)
DKIM signature
pass
Download raw message
On Sat Sep 9, 2023 at 2:20 PM UTC, Blain Smith wrote:
> I wonder if there is a better way to handle modules that end up in a 
> `./vendor` folder to make the experience a bit cleaner or update the 
> tutorial to bring attention to this fact that devs will need to specify 
> additional paths in `HAREPATH` at compile time to account for the 
> additional folder when using `git submodule` and `git subtree`.

there's a ticket for this: https://todo.sr.ht/~sircmpwn/hare/608

but also in most cases, you'd honestly be best off just, not vendoring
things
Details
Message ID
<1d102353-d7a3-4658-80b9-1158bdb5eee3@app.fastmail.com>
In-Reply-To
<FH2Q0S.TQNC6GD5C2SE3@gmail.com> (view parent)
DKIM signature
pass
Download raw message
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/ .
Details
Message ID
<UI7S0S.361E91KP8IP13@gmail.com>
In-Reply-To
<1d102353-d7a3-4658-80b9-1158bdb5eee3@app.fastmail.com> (view parent)
DKIM signature
pass
Download raw message
On Sun, Sep 10 2023 at 01:35:20 AM -04:00:00, John Gabriele 
<jgabriele@fastmail.fm> wrote:
> 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/ .

I just found it searching "harelang modules" and it was the first 
search engine result in Google and DuckDuckGo.
Reply to thread Export thread (mbox)