Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Support direct tuple access operators "tuple.N"


On Wed, 11 Jul 2018 14:58:56 +0000
Quentin Carbonneaux <quentin@xxxxxx> wrote:

> Hi myrddin-dev,
> 
> This patch adds tuple access expressions. If t is a tuple, its
> N-th component can be retrieved with the syntax t.N.  Of course,
> the components are zero indexed.  I believe the code also works
> if 't' is a pointer to a tuple (but I have not checked this).
> 
> Feel free to throw the code in a nearby incinerator, it is only
> very mildly tested, and was quite hastily hacked in public
> transportation.
> 
> Best,

One bug found:

	use std

	const foo = {
		-> (1, 2, (3, 4))
	}

	const main = {
		match foo()
		| x:
			std.put("a: {}, b: {}, c : {}\n", x.0, (x.2).1, foo().1)
		;;
	}

Crashes with:

	$ mbld -b t test.myr
        6m test.myr
		6m test.myr
	test.myr:10: Otupmemb cannot be an lvalue
	FAIL: 6m test.myr

And one syntactic annoyance, which I think we can live with:

    a.1.2.3

does not work, because we misrecognize a.1.2 as a float -- ie, 'a.(1.2)'.


-- 
Ori Bernstein <ori@xxxxxxxxxxxxxx>

Follow-Ups:
[PATCH] Support direct tuple access operators "tuple.N"Quentin Carbonneaux <quentin@xxxxxx>
References:
[PATCH] Support direct tuple access operators "tuple.N"Quentin Carbonneaux <quentin@xxxxxx>