~turminal

Ljubljana, Slovenia

~turminal/test

Last active 2 years ago

~turminal/public-inbox

Last active 3 years ago
View more

Recent activity

[PATCH hare] os::move: fix invalid match usage 7 hours ago

From Bor Grošelj Simić to ~sircmpwn/hare-dev

The first case was a subset of the second, which is not supposed to be
allowed, but isn't handled by harec yet.

Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
---
 fs/fs.ha | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/fs.ha b/fs/fs.ha
index 66f74025..5e813460 100644
--- a/fs/fs.ha
+++ b/fs/fs.ha
@@ -111,9 +111,12 @@ export fn rename(fs: *fs, oldpath: str, newpath: str) (void | error) = {
// copy and remove if necessary.
[message trimmed]

Re: How to append bytes to a file? 11 hours ago

From Bor Grošelj Simić to ~sircmpwn/hare-users

On Mon Apr 15, 2024 at 1:01 PM CEST, Vlad-Stefan Harbuz wrote:
> Hi!
>
> I think you want this:
>
>     os::open("file", fs::flag::WRONLY | fs::flag::APPEND)!
>
> I wonder if we should clear up the documentation on this somehow, I think you're the second person to ask this.

The problem here is that Hare copied the api directly from C, when we
could have split the flags parameter into 'mode' and 'flags', where mode is one
of RDONLY, WRONLY, RDWR, and everything else is flags. I'm not sure if this is
still fixable, it's a breaking change, and opening files is something a lot of
Hare code does.

Re: [PATCH harec v4] lex: allow digit separators 11 hours ago

From Bor Grošelj Simić to ~sircmpwn/hare-dev

Thanks!

To git@git.sr.ht:~sircmpwn/harec
   868b7f0..5d525a5  master -> master

Re: [PATCH harec] rt::compile ensure tests fail when "invalid" Hare is valid 11 hours ago

From Bor Grošelj Simić to ~sircmpwn/hare-dev

Thanks!

To git@git.sr.ht:~sircmpwn/harec
   c0db5b1..868b7f0  master -> master

Re: Test a function that prints to stdout 2 days ago

From Bor Grošelj Simić to ~sircmpwn/hare-users

Ah, I see kurth4cker already answered the same thing. Sorry!

Re: Test a function that prints to stdout 2 days ago

From Bor Grošelj Simić to ~sircmpwn/hare-users

On Sat Apr 13, 2024 at 8:31 AM CEST, Max Schillinger wrote:
> Hi all,
>
> I would like to write a test for a function that prints something to 
> stdout. My first try was to create a memio buffer and to redirect stdout 
> into this buffer somehow. See this minimal example:

That's a nice way to do it. Note however, that the testing runtime won't be
able to capture stdout for you if you do this, and you'll have a harder time
making use of it for your debugging.


> use fmt;
> use memio;

[PATCH hare] regex: fix typos in error messages 2 days ago

From Bor Grošelj Simić to ~sircmpwn/hare-dev

Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
---
 regex/regex.ha | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/regex/regex.ha b/regex/regex.ha
index 175eb851..137c904d 100644
--- a/regex/regex.ha
+++ b/regex/regex.ha
@@ -434,7 +434,7 @@ fn parse_repetition(
		min = match (strconv::stoi(min_str)) {
		case let res: int =>
			yield if (res < 0) {
				return `Negative repitition count '{-n}'`: error;
[message trimmed]

Re: State of debuggers 3 days ago

From Bor Grošelj Simić to ~sircmpwn/hare-users

> Is it possible to point gdb or another debugger at hare yet? I know
> there's been some work getting stack traces and line number information
> working but I don't know the extent of it. If not, what work still needs
> to be done to get all that working?

What Lorenz said, pretty much. Going into a bit more detail, dwarf leaves a lot
up to individual implementations to decide how to store debugging info
efficiently. A suitable representation needs to be picked and implemented in
harec. Then we need to figure out what's the best way to get that data into the
final executable. On one hand QBE could probably benefit from a reasonably
complete and integrated way to handle debugging information, but on the other
hand, that's a lot of work that needs a lot of thought put into interfacing,
and writing the debug infor directly into an assembly file from harec seems
easier and faster to get up and make useful.

Re: [RFC v1] handling allocation failure 3 days ago

From Bor Grošelj Simić to ~sircmpwn/hare-rfc

> thanks for the feedback! unless there is some more feedback, my
> plan is to implement this RFC this weekend.

You're of course welcome to implement the rfc before it's approved or even
thoroughly discussed (it can help the discussion, even), but note that we're
moving kinda slowly around here and one week is generally not enough time for
all the relevant people to give feedback, so you may have to change substantial
things in the implementation afterwards.

Re: [RFC v1] handling allocation failure 3 days ago

From Bor Grošelj Simić to ~sircmpwn/hare-rfc

>                               RFC SUMMARY
>
> hare builtin's should have some way of handling allocation failures.
>
> most apps probably don't want to handle allocation failure but
> rather crash. this proposal does not create any performance impact or
> additional complications in these cases, except adding a trailing "!"
> to builtins that might return nomem.
>
>                          LANGUAGE IMPLICATIONS
>
> nomem becomes a builtin type. it's error flag is always set.  basicly
> another void, unfortionately;