Re: datatype constructor as syntax

Thant Tessman <[email protected]>
Newsgroups gmane.comp.lang.ml.mlton.user
Message-ID <[email protected]>
On Jan 2, 2014, at 12:51 AM, Andreas Rossberg <[email protected]> wrote:
> 
>> On top of that, when I enter this interactively in SML/NJ, there is no warning. However, I just tried it with MLton, and it does indeed produce a warning:
> 
> It is mandatory that inexhaustive bindings produce a warning, _except_ on the toplevel (try “let val bar j = i in j end” for contrast).

I thought of that, but SML/NJ gives no warning even when the construction isn't at the top level:


Standard ML of New Jersey v110.76 [built: Fri Jul 19 11:38:59 2013]

- datatype mytype = foo | bar of int;
datatype mytype = bar of int | foo
- val i = bar 3;
val i = bar 3 : mytype
- val j = foo;
val j = foo : mytype
- fun doit x = 
    let
	val (bar j) = x
    in
	j
    end;

= = = = = val doit = fn : mytype -> int
- 
- doit;
val it = fn : mytype -> int
- doit i;
val it = 3 : int
- doit j;

uncaught exception Bind [nonexhaustive binding failure]
  raised at: stdIn:124.6-124.17



-thant

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.