~yerinalexey

~yerinalexey/public-inbox

Last active 9 months ago

~yerinalexey/hare-sql

Last active 1 year, 7 months ago
View more

Recent activity

[RFC v2] Tagged union overhaul 13 days ago

From Alexey Yerin to ~sircmpwn/hare-rfc

                              RFC SUMMARY

Tagged unions are the flagship feature of Hare, however their
implementation isn't perfect. In their current state, they have a lot
of issues from both user's and compiler developer's perspective.

On the user side, tagged union assignability semantics can be confusing
and create unexpected results. Their behaviour is not well documented.

On the compiler side, parts of harec that work with tagged unions are
quite complex and interconnected, making even small fixes difficult
without breaking something else. The existing infrastructure does not
have the tools to implement much needed features such as exhaustivity
checking in match expressions. Not to mention that there are lots of

[PATCH hare v3] cmd/hare: Skip replacing the output file if possible 21 days ago

From Alexey Yerin to ~sircmpwn/hare-dev

Fixes: https://todo.sr.ht/~sircmpwn/hare/953
Signed-off-by: Alexey Yerin <yyp@disroot.org>
---
v2 -> v3: Actually commit genbootstrap changes

 cmd/hare/build.ha            | 17 +++++++++++++++++
 makefiles/freebsd.aarch64.mk |  2 +-
 makefiles/freebsd.riscv64.mk |  2 +-
 makefiles/freebsd.x86_64.mk  |  2 +-
 makefiles/linux.aarch64.mk   |  2 +-
 makefiles/linux.riscv64.mk   |  2 +-
 makefiles/linux.x86_64.mk    |  2 +-
 makefiles/netbsd.aarch64.mk  |  2 +-
 makefiles/netbsd.riscv64.mk  |  2 +-
[message trimmed]

[PATCH hare v2] cmd/hare: Skip replacing the output file if possible 21 days ago

From Alexey Yerin to ~sircmpwn/hare-dev

Fixes: https://todo.sr.ht/~sircmpwn/hare/953
Signed-off-by: Alexey Yerin <yyp@disroot.org>
---
v1 -> v2: genbootstrap strikes again

 cmd/hare/build.ha | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/cmd/hare/build.ha b/cmd/hare/build.ha
index bc6589a7..07b9553a 100644
--- a/cmd/hare/build.ha
+++ b/cmd/hare/build.ha
@@ -20,6 +20,7 @@ use os;
use path;
[message trimmed]

[PATCH hare] cmd/hare: Skip replacing the output file if possible 21 days ago

From Alexey Yerin to ~sircmpwn/hare-dev

Fixes: https://todo.sr.ht/~sircmpwn/hare/953
Signed-off-by: Alexey Yerin <yyp@disroot.org>
---
 cmd/hare/build.ha | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/cmd/hare/build.ha b/cmd/hare/build.ha
index bc6589a7..07b9553a 100644
--- a/cmd/hare/build.ha
+++ b/cmd/hare/build.ha
@@ -20,6 +20,7 @@ use os;
use path;
use strconv;
use strings;
[message trimmed]

[RFC v1] Tagged union overhaul a month ago

From Alexey Yerin to ~sircmpwn/hare-rfc

                              RFC SUMMARY

Tagged unions are the flagship feature of Hare, however their
implementation isn't perfect. In their current state, they have a lot
of issues from both user's and compiler developer's perspective.

On the user side, tagged union assignability semantics can be confusing
and create unexpected results. There are no well written rules for how
they work.

On the compiler side, parts of harec that work with tagged unions are
quite complex and interconnected, making even small fixes difficult
without breaking something else. The existing infrastructure does not
have the tools to implement much needed features such as exhaustivity

[PATCH] ScrollUpHighlight: Correctly handle messages that span multiple lines 4 months ago

From Alexey Yerin to ~delthas/senpai-dev

---
 ui/buffers.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ui/buffers.go b/ui/buffers.go
index 6d1cc70..b6b852f 100644
--- a/ui/buffers.go
+++ b/ui/buffers.go
@@ -640,11 +640,12 @@ func (bs *BufferList) ScrollUpHighlight() bool {
	y := 0
	for i := len(b.lines) - 1; 0 <= i; i-- {
		line := &b.lines[i]
		height := len(line.NewLines(bs.ui.vx, bs.textWidth)) + 1
		if ymin <= y && line.Highlight {
[message trimmed]

[PATCH harec v2] types: Fix enum castability check 4 months ago

From Alexey Yerin to ~sircmpwn/hare-dev

It was checking if the source is an integer, not the destination. This
made it so all integer-based enums could be cast to any type.

Also, rune enums weren't handled here at all.

Reported at: https://lists.sr.ht/~sircmpwn/hare-users/%3Cd65c8dccf8f704e9fa5bf41cbca9e3dc@disroot.org%3E

Signed-off-by: Alexey Yerin <yyp@disroot.org>
---
v1 -> v2: actually fix castability

 src/types.c            | 5 ++++-
 tests/15-enums.ha      | 8 ++++++++
 tests/26-regression.ha | 2 ++
[message trimmed]

[PATCH harec] types: Fix enum castability check 4 months ago

From Alexey Yerin to ~sircmpwn/hare-dev

It was checking if the source is an integer, not the destination. This
made it so all integer-based enums could be cast to any type.

Reported at: https://lists.sr.ht/~sircmpwn/hare-users/%3Cd65c8dccf8f704e9fa5bf41cbca9e3dc@disroot.org%3E

Signed-off-by: Alexey Yerin <yyp@disroot.org>
---
 src/types.c            | 2 +-
 tests/26-regression.ha | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/types.c b/src/types.c
index 154acc7..1cb9b67 100644
--- a/src/types.c
[message trimmed]

[PATCH hare] hare+libc.sc: Separate .test_array from RELRO sections 4 months ago

From Alexey Yerin to ~sircmpwn/hare-dev

In some configurations (on FreeBSD, or on LLD <= 17), putting
.test_array between RELRO sections (for example, between .dynamic and
.got.plt) caused a linking failure.

Signed-off-by: Alexey Yerin <yyp@disroot.org>
---
 rt/+freebsd/hare+libc.sc | 5 ++++-
 rt/+linux/hare+libc.sc   | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/rt/+freebsd/hare+libc.sc b/rt/+freebsd/hare+libc.sc
index ade57fe4..9471408e 100644
--- a/rt/+freebsd/hare+libc.sc
+++ b/rt/+freebsd/hare+libc.sc
[message trimmed]

The duality of type alias semantics 4 months ago

From Alexey Yerin to ~sircmpwn/hare-dev

Type aliases in Hare currently have two separate uses:

1. To give a name to an existing type for clarity, for example, name
   a function type to avoid writing out the signature every time. In
   this case, no distinct type should be created.

2. To create a new distinct type with the same storage as the underlying
   type. This is used for void aliases, structs, enums, etc. These types
   carry a semantic meaning or an invariant (e.g. that an `io::file`
   must be a valid file descriptor on Unix-like systems).

Hare conflates those two cases which can lead to unintuitive behaviour.

For example, consider two snippets: