Reason: Support for private extensible variants?

Created on 28 Feb 2017  路  11Comments  路  Source: reasonml/reason

Right now it doesn't look like private constructors are respected in reason.

Original OCaml:

type foo += private C of int

Actual:

type foo +=
  | C int;

Expected:

type foo +=
  | private C int; /* Error: Unbound value pri */
GOOD FIRST TASK

Most helpful comment

So it parses, but prints incorrectly. I'll fix it.

All 11 comments

Hot damn what are you trying to do

@chenglou don't worry about it 馃暤馃徎

Great first task and high pri because it's regarding completeness!

Should be familiar terrain for me, will look into it

@IwanKaramazow 馃挭

Ok, this was already implemented.

type water = ..;
type molecules = string;
type water += pri Ocean molecules;

Reason uses pri instead of private, this probably originates from @SanderSpies's new object syntax. Do we just document this? Or should I make it private in this case?

Ahh interesting - when I refmt that code I get:

type water = ..
type molecules = string
type water +=
  | Ocean of molecules

So maybe it's just an issue with refmt not handling it? It doesn't work in any direction ml <=> re or self formatting.

So it parses, but prints incorrectly. I'll fix it.

In general it would be great if we could try to convert more OCaml libraries to Reason and see if it works.

Might want to do this on top of Fred's diff.

Opened a PR that should be compatible with Fred's diff, cherry-picking the commit should suffice?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kyldvs picture kyldvs  路  3Comments

chenglou picture chenglou  路  3Comments

TheSpyder picture TheSpyder  路  3Comments

cristianoc picture cristianoc  路  4Comments

bobzhang picture bobzhang  路  3Comments