~sircmpwn/hare-users

4 2

Using append with type aliases

Details
Message ID
<cQ18QLphlVx7iH9N9bY-TocynQ71uPr5JqQGnkgvXoFa4vJX0tXhY4xZU57zx8chQNlfG7X12tLcyuNkpdNp0E54GFOsGjdpEc30beh5Zr4=@protonmail.com>
DKIM signature
missing
Download raw message
Good day!

I wanted to ask about the append built-in, is it impossible to use it
with type aliases for slices?
Details
Message ID
<CQ22UE5JBFGO.35G5EKI79XLFX@taiga>
In-Reply-To
<cQ18QLphlVx7iH9N9bY-TocynQ71uPr5JqQGnkgvXoFa4vJX0tXhY4xZU57zx8chQNlfG7X12tLcyuNkpdNp0E54GFOsGjdpEc30beh5Zr4=@protonmail.com> (view parent)
DKIM signature
missing
Download raw message
This question is trivially answered by writing a small program to test
it for yourself:

type foo = []int;

export fn main() void = {
	let x: foo = [];
	append(x, 10);
};
Details
Message ID
<PVIDBM4bOrVGP_hwy9c6kECZ_iFWt5iqgcnYNpYd1FvJ8CGdKaK2sJHUSKp689UremZJmJAS5srSDPSUaDhz0SQ8AyfmaHrc4M1CqqowYAI=@protonmail.com>
In-Reply-To
<CQ22UE5JBFGO.35G5EKI79XLFX@taiga> (view parent)
DKIM signature
missing
Download raw message
Apologies, I confused myself.  The error in my code was elsewhere, I
mixed up the var name for the type name.

I did some testing, "slice type" from spec refers to any type alias for
a slice type no matter the nesting, right?
Details
Message ID
<CQ23C1ZPJRCN.EO9YSZ14JZDR@taiga>
In-Reply-To
<PVIDBM4bOrVGP_hwy9c6kECZ_iFWt5iqgcnYNpYd1FvJ8CGdKaK2sJHUSKp689UremZJmJAS5srSDPSUaDhz0SQ8AyfmaHrc4M1CqqowYAI=@protonmail.com> (view parent)
DKIM signature
missing
Download raw message
On Thu Jan 26, 2023 at 12:36 PM CET, KAAtheWise wrote:
> I did some testing, "slice type" from spec refers to any type alias for
> a slice type no matter the nesting, right?

Yes.
Details
Message ID
<gj2cM7f7y6b2ehCgDN_74iPdO_0DGsINO7MLYrcPh8BT0IVQsxXEzK8RphXCP9sdabM_W_Nn2LcmmhY6t7DLkhDzAYKMB7Wcis-z0KqrSwE=@protonmail.com>
In-Reply-To
<CQ23C1ZPJRCN.EO9YSZ14JZDR@taiga> (view parent)
DKIM signature
missing
Download raw message
Thanks!
Reply to thread Export thread (mbox)