[nem-bug] [Nemerle 0000761]: Wrong erroe message (MatchFailureException instead InvalidProgramException)

feedback at nemerle.org feedback at nemerle.org
Wed Nov 8 23:36:34 CET 2006


The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=761> 
======================================================================
Reported By:                VladD2
Assigned To:                malekith
======================================================================
Project:                    Nemerle
Issue ID:                   761
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     resolved
Resolution:                 not an issue
Fixed in Version:           
======================================================================
Date Submitted:             09-21-2006 15:12 CEST
Last Modified:              11-08-2006 23:36 CET
======================================================================
Summary:                    Wrong erroe message (MatchFailureException instead
InvalidProgramException)
Description: 
using System;
using System.Console;
using Nemerle.Utility;

class Test
{
        mutable menus: list[char * string];
        mutable menus2: list[char * string];
        mutable menus3: list[char * string];
     
        public PrintMenus(): void
        {
            menus = ('a', "some a") :: [];
            menus.Iter((c, s) => WriteLine($" $c - $s"));

            menus2 ::= ('a', "some a");
            menus2.Iter((c, s) => WriteLine($" $c - $s"));
 
            menus3 += [('a', "some a")];
            menus3.Iter((c, s) => WriteLine($" $c - $s"));
        }
}

def t = Test();
t.PrintMenus ();


-------------------------------------------------------------------------------
a - some a
 a - some a

Unhandled Exception: Nemerle.Core.MatchFailureException: Exception of type
'Nemerle.Core.MatchFailureException' was thrown.
   at Nemerle.Collections.List.Iter['a](list`1 l, FunctionVoid`1 f) in
D:\MyProjects\RSDN\Nemerle\nemerle\lib\list.n:line 841

   at Nemerle.Core.list`1.Iter(FunctionVoid`1 f) in
D:\MyProjects\RSDN\Nemerle\nemerle\lib\list.n:line 284
   at Test.PrintMenus() in C:\Documents and Settings\VladAdm\Local
Settings\Application Data\Temporary Projects\ConsoleApplic
ation1\Main.n:line 17
   at _N_AutoModule.Main() in C:\Documents and Settings\VladAdm\Local
Settings\Application Data\Temporary Projects\ConsoleApp
lication1\Main.n:line 25
-------------------------------------------------------------------------------


See also: http://nemerle.org/bugs/view.php?id=760
======================================================================

----------------------------------------------------------------------
 Snaury - 09-21-06 16:18 
----------------------------------------------------------------------
My oppinion is that error message is not wrong at all (because when
matching value is not head nor tail, it is null, and thus matching fails
on it). But concerning your bug 760, I think that maybe null should be
treated same as Head (i.e. []) in matching?

----------------------------------------------------------------------
 malekith - 11-08-06 23:36 
----------------------------------------------------------------------
We once had NullMatchException, but we dropped it as it complicated matcher
code, induced some additional runtime costs and in most cases didn't bring
any additional information with it.

The best thing to do here, would be to make library functions throw
ArgumentExceptoion() in such case. I however doubt this can be done
without additional runtime costs.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
09-21-06 15:12 VladD2         New Issue                                    
09-21-06 16:18 Snaury         Note Added: 0001450                          
11-08-06 23:36 malekith       Status                   new => resolved     
11-08-06 23:36 malekith       Resolution               open => not an issue
11-08-06 23:36 malekith       Assigned To               => malekith        
11-08-06 23:36 malekith       Note Added: 0001499                          
======================================================================




More information about the bugs mailing list