Re: design question

2022-02-08 Thread Hongwei Xi
Currently, my practice is just declare something like:

abstype myenum = int

or

abstype myenum(i:int) = int

Then implement 'myenum' somewhere in a file. It can clearly be done, but it
is really tedious,
involving a lot of boilerplate type of code. I suppose some kind of
meta-programming can be
supported so as to reduce/eliminate this kind of coding.


On Tue, Feb 8, 2022 at 6:47 PM Raoul Duke  wrote:

> hi, a scenario
>
> enum of n values.
> api function that takes the enum.
> but throws error for some subset of enum values.
>
> how could we statically be told, enforce do not call the api fn in those
> cases?
>
> besides "rtfm".
>
> --
> You received this message because you are subscribed to the Google Groups
> "ats-lang-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ats-lang-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ats-lang-users/CAJ7XQb7erubNjQotU8ap_J4_4Eaks%2B%3DDabqyZU6jeRnGMYGf7w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLoX0O-RraTymYT6JEJNzEmwRhQbJuUdEKT54tJrkCT8-A%40mail.gmail.com.


Re: design question

2022-02-08 Thread Vanessa McHale
You could I suppose have a polymorphic type and pass in ‘void’. I had an idea 
for something here: http://blog.vmchale.com/article/ann 


In ATS I guess it would be

datatype Impossible

datatype A(phantom: type) = A | B | C of (phantom)

Then A(Impossible) would be sort of like a subtype of A(void) or at least you 
could manipulate it like that.

I’m not sure such a solution is worth it though! Might be better to just RTFM :P

Cheers,
Vanessa McHale

> On Feb 8, 2022, at 5:47 PM, Raoul Duke  wrote:
> 
> hi, a scenario 
> 
> enum of n values. 
> api function that takes the enum. 
> but throws error for some subset of enum values. 
> 
> how could we statically be told, enforce do not call the api fn in those 
> cases?
> 
> besides "rtfm". 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "ats-lang-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ats-lang-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ats-lang-users/CAJ7XQb7erubNjQotU8ap_J4_4Eaks%2B%3DDabqyZU6jeRnGMYGf7w%40mail.gmail.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/6E3FE33B-F1BA-4703-BEEB-0F09DFB2C5FF%40gmail.com.


design question

2022-02-08 Thread Raoul Duke
hi, a scenario

enum of n values.
api function that takes the enum.
but throws error for some subset of enum values.

how could we statically be told, enforce do not call the api fn in those
cases?

besides "rtfm".

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAJ7XQb7erubNjQotU8ap_J4_4Eaks%2B%3DDabqyZU6jeRnGMYGf7w%40mail.gmail.com.