~pierrec

Recent activity

Re: [PATCH harec] Permit type inference for globals 26 days ago

From Pierre Curto to ~sircmpwn/hare-dev

good catch. Will update accordingly.

Le mar. 30 août 2022 à 10:26, Armin Weigl <tb46305@gmail.com> a écrit :
>
> Please add tests with named structs, these probably need more work.
>
> Example (order of declarations important):
>
> const val = t {
> field = 1,
> };
> type t = {
> field: int,
> };

Re: [PATCH harec] harec: fix slice OOB checks when start > end a month ago

From Pierre Curto to ~sircmpwn/hare-dev

> > @@ -2452,6 +2453,23 @@ check_expr_slice(struct context *ctx,
> >               return;
> >       }
> >
> > +     if (expr->slice.start && expr->slice.end
> > +             && type_is_constant(itype) && type_is_constant(jtype)) {
>
> type_is_constant only checks whether the type is a flexible constant,
> not if the expression returning the type is evaluable at compile time.
>
> this will fail for expressions which are computable at translation time
> but don't return flexible constants:
>         ... = slice[2z..1z];
>

stdlib: math module: add trailing_zeros_* a month ago

From Pierre Curto to ~sircmpwn/hare-users

I can see the leading_zeros_* functions in the math module, but not
the trailing_zeros_*
ones.
I would be interested in working on this if this is OK.

Thanks

bitwise and assignment a month ago

From Pierre Curto to ~sircmpwn/hare-users

On Hare dev+296925c9, the following does not work:
const h &= MASK;

as I get an "expected ':', '='" error message

whereas the following works fine:
const h = h & MASK;

Am I doing something wrong?

Re: Handling thousands of clickable areas 2 months ago

From Pierre Curto to ~eliasnaur/gio

[resending as plain text and to the mailing list]
Hi,

My solution to this, while building an image pixel editor where I had
to draw pixels as squares, was to use an ImageOp and draw the items in
it. This allowed me to handle large images. In my case it was also
simple to handle which pixel was clicked as they were all of the same
size, so one InputOp and some maths got me there.

HTH


Le mar. 28 juin 2022 à 23:24, Dominik Honnef <dominik@honnef.co> a écrit :
>

Re: using try in expressions 7 months ago

From Pierre Curto to ~andrewrk/ziglang

Hello Gunnar,

You need to wrap your fn call as the parser is reading all of your
expression as the argument for try.

const std = @import("std");

fn testfn() !u32 {
    return 17;
}

test {
    if ((try testfn()) == 17) {
        std.debug.print("worked.", .{});

Re: Gio News, January + 0.5*February 2022 7 months ago

From Pierre Curto to ~eliasnaur/gio

Indeed, great work Chris!

Le lun. 14 févr. 2022 à 19:23, Elias Naur <mail@eliasnaur.com> a écrit :
>
> Great read, well worth the wait!
>
> Elias

Re: [PATCH gio 0/1] More to do 7 months ago

From Pierre Curto to ~eliasnaur/gio-patches

Le sam. 29 janv. 2022 à 12:30, Elias Naur <mail@eliasnaur.com> a écrit :
>
> On Fri Jan 28, 2022 at 09:19, ~pierrec wrote:
> > Maybe the Decorations state struct should be moved to the widget
> > package. This causes some challenges so I havent yet.
>
> What's the challenges? Not top priority, but it would be nice to have a re-usable
> Decorations widget to base one's own custom decorations off of.
>

Indeed. The main thing I am running into is that Decorations needs to maintain
the state of many things, not just one as is the case with existing widgets.

I currently think about having separate methods, as follows:

Re: [PATCH gio] op/clip: automatically close Path in Outline 9 months ago

From Pierre Curto to ~eliasnaur/gio-patches

> >  // Op returns a clip operation representing the outline.
> > +// The path is automatically closed if that is not already the case.
> >  func (o Outline) Op() Op {
> >       if o.Path.open {
> > -             panic("not all path contours are closed")
> > +             // Closing the path as it is a requirement for an Outline.
> > +             // This fixes cases where relative methods were used on Path
> > +             // which produce rounding errors and have a Path not exactly
> > +             // closed whereas it should have been.
> > +             o.Path.from.Close()
>
> I don't think this is enough. Consider a path that looks like "CC",
> with two gaps; Path.Close only closes the last gap.
>

Re: [PATCH gio] gpu/headless: add ScreenshotInto method to Window 9 months ago

From Pierre Curto to ~eliasnaur/gio-patches

Oups I didnt mean to include ScreenshotRegion. But I will merge all of
them into:

// Screenshot transfers the Window content at origin to img.
func Screenshot(origin image.Point, img *image.RGBA) error

Le mer. 15 déc. 2021 à 10:01, Elias Naur <mail@eliasnaur.com> a écrit :
>
> On Wed Dec 15, 2021 at 08:59 CET, ~pierrec wrote:
> > From: Pierre Curto <pierre.curto@gmail.com>
> >
> > When extracting headless.Window's content via screenshots,
> > it can be useful to keep reusing the same image for output,
> > as well as specify which area of the Window is to be