~smlavine

~smlavine/onclick-announce

Last active 2 months ago

~smlavine/onclick-devel

Last active 2 months ago

~smlavine/colat-devel

Last active 7 months ago

~smlavine/colat-announce

Last active 7 months ago

~smlavine/err-announce

Last active 1 year, 3 months ago

~smlavine/bf-announce

Last active 1 year, 4 months ago

~smlavine/bf-devel

Last active 1 year, 4 months ago

~smlavine/globalregularexpressionprint-devel

Last active 1 year, 4 months ago

~smlavine/globalregularexpressionprint-announce

Last active 1 year, 4 months ago

~smlavine/smlss-announce

Last active 1 year, 7 months ago
View more

Recent activity

Re: [PATCH hare 2/2] fmt: rename type mods to modset 7 days ago

From Sebastian LaVine to ~sircmpwn/hare-dev

-1 -- extra 2 characters a line for no more real detail. Could muddy the waters with the idea of a mathematical set, which this isn't.


-------- Original Message --------
From: Byron Torres <b@torresjrjr.com>
Sent: February 20, 2024 1:38:24 AM UTC
To: ~sircmpwn/hare-dev@lists.sr.ht
Cc: Byron Torres <b@torresjrjr.com>
Subject: [PATCH hare 2/2] fmt: rename type mods to modset

A set of modifiers, a modifier-set, or modset for short.

Breaking-Change: 0.24.0
Signed-off-by: Byron Torres <b@torresjrjr.com>
[message trimmed]

Re: Is Valgrind working with Hare? Or any way to analyze memory uage 25 days ago

From Sebastian LaVine to ~sircmpwn/hare-users

On Fri Feb 2, 2024 at 11:28 AM EST, Enno Tensing wrote:
> Hi Dmitry,
>
> On 24/02/02 17:08:51, Dmitry B wrote:
> > So I have two question:
> > 1. Is Valgrind works with Hare? I do not know how it works but it did
> > not showed unfreed memory in my hare app.
>
> Valgrind can profile hare-programs, if they've been linked with libc.
>
> > 2. Is it enough to log size of every memory allocated in heap to get
> > an understanding how much app use RAM?
>
> There are tools, like memusage, that can give you that information,

Re: Array of anonymous struct possible in Hare? a month ago

From Sebastian LaVine to ~sircmpwn/hare-users

On Tue Jan 23, 2024 at 9:28 AM EST, Geert Van Laethem wrote:
> Hey all,
>
>
> Is the following possible?
>
>     let tests: []struct { x: str, y: str } = [
>          { "a", "b" }
>     ];
>

Yes, but not in as concise a syntax. Like all struct literals, you need
the name of the struct (in this case, just `struct`) and additionally
anonymous struct literals require the type to be specified as well. So

Re: [RFC v3] for-each loops a month ago

From Sebastian LaVine to ~sircmpwn/hare-rfc

I had an idea on this that I mentioned on IRC a week or so ago: what
about adding an @done attribute, and allowing "doneness" to be an
attribute of a type in the same way that a type can be an error type?

strings::next becomes

        export fn next(iter: *iterator) (rune | @done void);

for instance.

This component of the idea would require more consideration, but ecs
mentioned that this could also lead to for-loops that yield values on
breaking. Like so:

[PATCH hare] strings: Simplify fromutf8 a month ago

From Sebastian LaVine to ~sircmpwn/hare-dev

This is a small change, but to a newer reader of the standard library
this is a clearer way of showing the order of the steps the function
takes.

Signed-off-by: Sebastian LaVine <mail@smlavine.com>
---
 strings/utf8.ha | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/strings/utf8.ha b/strings/utf8.ha
index c23aa6ee..f7ea1247 100644
--- a/strings/utf8.ha
+++ b/strings/utf8.ha
@@ -20,9 +20,8 @@ export fn fromutf8_unsafe(in: []u8) str = {
[message trimmed]

[PATCH hare v2] encoding::utf8: Rename valid() to validate() and change return type 2 months ago

From Sebastian LaVine to ~sircmpwn/hare-dev

As shown in the changes made to the stdlib to complement this change,
this allows for a common idiom to be expressed more concisely with the
`?` operator. This also aligns with the interface of the prev() and
next() iterators.

Signed-off-by: Sebastian LaVine <mail@smlavine.com>
---

v1 -> v2:
- Verbify the function name to validate()

 encoding/utf8/decode.ha | 21 +++++++++++----------
 strings/utf8.ha         |  4 +---
 types/c/strings.ha      |  4 +---
[message trimmed]

Re: [PATCH hare] encoding::utf8: Change valid() return type 2 months ago

From Sebastian LaVine to ~sircmpwn/hare-dev

On Thu Dec 28, 2023 at 2:49 AM EST, Drew DeVault wrote:
> +1 for "validate". Don't think we need two functions.

Okay, I will send off a v2 to this effect. Thanks.

Re: [RFC v2] iterating easier with for 2 months ago

From Sebastian LaVine to ~sircmpwn/hare-rfc

On Wed Dec 27, 2023 at 3:34 PM EST, Byron Torres wrote:
> On Wed Dec 27, 2023 at 5:14 PM GMT, Lorenz (xha) wrote:
> >                               RFC SUMMARY
> >
> > as discussed in the v1, i think that `for (true) match()` is too
> > verbose and c-style loops are kinda error-prone, unintitive and
> > hard(er) to read.
>
> ## for-each iterator feature
>
> I disagree that `for (true) match ()` is so verbose it needs changing.
> The typical compound expression form `for (true) { ~~~; ~~~; ~~~; };`
> is merely one case. To my Hare programmer eyes, this has always been:
>

Re: [PATCH hare] encoding::utf8: Change valid() return type 2 months ago

From Sebastian LaVine to ~sircmpwn/hare-dev

On Wed Dec 27, 2023 at 3:40 PM EST, Alexey Yerin wrote:
> I think it would be better to keep valid() to return bool, and instead add
> check() which returns (void | utf8::invalid). This makes more sense with regard
> to naming - valid is an adjective and shows that the function queries a
> property, but that's not the case anymore with this patch.

Perhaps validate(). I think it best to have one or the other, though,
not both with a slightly different API. If we are to choose, I think
that getting rid of the one that returns bool is best because of the
reasons outlined in the patch commentary.

Thanks for the response!

[PATCH hare] encoding::utf8: Change valid() return type 2 months ago

From Sebastian LaVine to ~sircmpwn/hare-dev

As shown in the changes made to the stdlib to complement this change,
this allows for a common idiom to be expressed more concisely with the
`?` operator. This also aligns with the interface of the prev() and
next() iterators.

Signed-off-by: Sebastian LaVine <mail@smlavine.com>
---

As in stdlib code, this is also handy in application code. Consider the
following code which reads in a []u8 and checks that it is UTF-8, but
unlike strings::fromutf8 does not convert it to a str:

fn run(c: *config) (io::error | utf8::invalid | void) = {
 let in = io::drain(c.in)?;
[message trimmed]