[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: union member already defined?
- Subject: Re: union member already defined?
- From: theos <theosjp@xxxxxxxxx>
- Reply-to: myrddin-dev@xxxxxxxxxxxxxx
- Date: Mon, 30 Jul 2018 23:21:43 +0900
- To: Ori Bernstein <ori@xxxxxxxxxxxxxx>, myrddin-dev@xxxxxxxxxxxxxx
iriri / ori -
thank you very much for the explanation. it makes more sense now,
particularly when contrasted with the alternatives.
i'll keep going.
btw, when looking at some of your code i've noticed that i had to add a
window size parameters to get irc.myr to build. i suppose that github
version isnt actively developed anymore as you have been focusing your
energy onto other aspects.
thanks,
theo.
diff --git a/main.myr b/main.myr
index 6952272..8c1581a 100644
--- a/main.myr
+++ b/main.myr
@@ -180,7 +180,7 @@ const terminput = {irc, chan
match termdraw.poll(irc.term)
| `std.None:
break
- | `std.Some `termdraw.Winsz:
+ | `std.Some `termdraw.Winsz (80, 24):
irc.chandirty = true
irc.cmddirty = true
| `std.Some `termdraw.Kc '\t':
On 07/30/2018 06:23 AM, Ori Bernstein wrote:
> On Sun, 29 Jul 2018 20:50:28 +0900, theos <theosjp@xxxxxxxxx> wrote:
>
>> hi iriri -
>>
>> thanks for the hello and welcome. yes, i find what you guys have been
>> putting together really amazing.
>
> Thanks. :)
>
>> regarding the union - hmm... interesting. i've had noticed that the
>> code compiled when i made the tags unique, but i thought that this cant
>> be right.
>>
>> do you know what the motivation was to scope it this way compared to c?
>
> In addition to what iri said, the way that unions are constructed is:
>
> var u = `Uniontag val
>
> And the unions values are extracted by pattern matching
> like so:
>
> match u
> | `Uniontag v: std.put("v")
> ;;
>
> So, without enforcing uniqueness, it would be impossible to
> know which union was referred to.
>
> And, honestly, the 'std.' in union lookups is annoying enough:
>
> match fn()
> | `std.Ok result: use(result)
> | `std.Err error: fail(error)
> ;;
>
> Turning it into:
>
> match fn()
> | `std.result(mytype).Ok result: use(result)
> | `std.result(mytype).Err error: fail(error)
> ;;
>
> didn't seem appealing. I think that a very early attempt used
> to do this, but I can't remember if I ever committed it, or
> whether I just mocked up some code, decided it was clunky,
> and ditched it.
>
>> thanks,
>> theo
>
>
>