~ecs

trapped on the surface of a sphere

https://ecs.d2evs.net

Recent activity

[PATCH hare-specification] Fix table of contents 3 days ago

From Ember Sawady to ~sircmpwn/hare-dev

Signed-off-by: Ember Sawady <ecs@d2evs.net>
---
The .PHONY doesn't work with the added rules, so this was broken in the
CI
 .build.yml | 1 -
 Makefile   | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.build.yml b/.build.yml
index 037faf6..7674a0e 100644
--- a/.build.yml
+++ b/.build.yml
@@ -27,7 +27,6 @@ tasks:
- build: |
[message trimmed]

[PATCH hare] os::fs_create_file: add O_TRUNC by default 3 days ago

From Ember Sawady to ~sircmpwn/hare-dev

Fixes fs::move where the destination file is larger than the source file

Signed-off-by: Ember Sawady <ecs@d2evs.net>
---
Fun fact: that 0z dates back to February 2021, 8 days before I
implemented type promotion and the initial version of iconst
 os/+linux/dirfdfs.ha | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/os/+linux/dirfdfs.ha b/os/+linux/dirfdfs.ha
index 12c375b7..b0fbb68b 100644
--- a/os/+linux/dirfdfs.ha
+++ b/os/+linux/dirfdfs.ha
@@ -210,8 +210,8 @@ fn fs_create_file(
[message trimmed]

[PATCH harec v2] Fix tagged unions containing t and !t 3 days ago

From Ember Sawady to ~sircmpwn/hare-dev

Or more broadly, any types which are identical besides type flags

Signed-off-by: Ember Sawady <ecs@d2evs.net>
---
v1 => v2: whoops, the padding patch got in the way
 include/types.h |  2 +-
 src/check.c     |  4 ++--
 src/eval.c      |  2 +-
 src/gen.c       | 14 +++++++-------
 src/types.c     | 26 ++++++++++++++++++--------
 tests/26-gen.ha |  5 +++++
 6 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/include/types.h b/include/types.h
[message trimmed]

[PATCH harec] Fix tagged unions containing t and !t 3 days ago

From Ember Sawady to ~sircmpwn/hare-dev

Or more broadly, any types which are identical besides type flags

Signed-off-by: Ember Sawady <ecs@d2evs.net>
---
Should hopefully be the last of the tagged_select_subtype assertions
 include/types.h |  2 +-
 src/check.c     |  4 ++--
 src/eval.c      |  2 +-
 src/gen.c       | 14 +++++++-------
 src/types.c     | 26 ++++++++++++++++++--------
 tests/26-gen.ha |  5 +++++
 6 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/include/types.h b/include/types.h
[message trimmed]

Re: [harelang.org] tutorial: mention alloc's automatic size calculation 4 days ago

From Ember Sawady to ~sircmpwn/hare-dev

git config format.subjectPrefix 'PATCH harelang.org'

[PATCH harec] Fix null check for slice alloc 4 days ago

From Ember Sawady to ~sircmpwn/hare-dev

Signed-off-by: Ember Sawady <ecs@d2evs.net>
---
 src/gen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gen.c b/src/gen.c
index 13579ec..c07eada 100644
--- a/src/gen.c
+++ b/src/gen.c
@@ -416,7 +416,7 @@ gen_alloc_slice_at(struct gen_context *ctx,

	struct qbe_statement linvalid;
	struct qbe_value binvalid = mklabel(ctx, &linvalid, ".%d");
	pushi(ctx->current, &cmpres, Q_CNEL, &size, &zero, NULL);
[message trimmed]

Re: Const overhaul proposal 4 days ago

From Ember Sawady to ~sircmpwn/hare-dev

On Sun Jan 22, 2023 at 9:49 AM UTC, Drew DeVault wrote:
> > - The added required `mut` for mutable declarations may be annoying,
> >   especially in for-loops, where `let i = 0z` becomes `let mut i = 0z`
>
> We could make mutable bindings without the "let" keyword, e.g.
> `mut i = 0z`. Not sure how much I hate that, would have to see some
> longer-form code samples making use of it.

What about var for mutable bindings? I think that's something some other
languages have done.

Re: Error Handling in JSON Loader 5 days ago

From Ember Sawady to ~sircmpwn/hare-users

Yes, that's correct

Re: Tagged Union Instances in Memory 6 days ago

From Ember Sawady to ~sircmpwn/hare-users

The rationale was laid out in a combination of that thread and
https://lists.sr.ht/~sircmpwn/hare-dev/%3CCI26KM02FKCT.3RWGVA6A9CVY6%40eiger%3E

Re: Tagged Union Instances in Memory 6 days ago

From Ember Sawady to ~sircmpwn/hare-users

On Fri Jan 20, 2023 at 3:51 PM UTC, KAAtheWise wrote:
> Given this, can I ask You about the pointer itself? Does the fact that
> the struct for the tagged union can have padding before the tag mean,
> that data about the tagged union is also stored with the pointer? (aka,
> how does the pointer know wherever it needs to step over the padding or
> not?) Maybe You can direct me to the place in the source code where the
> pointers are handled, I am just having a hard time understanding which
> part of the compiler does what.

The pointer doesn't know anything about the data it points to - the
relevant logic would be getting the tag from a tagged union, see
https://lists.sr.ht/~sircmpwn/hare-dev/patches/37664 for the version
that corresponds to what the spec says. Basically, the compiler always
knows the type of the tagged union at compile time, so it emits the