[nem-bug] [Nemerle 0000829]: Methods and properties can't have the same names

feedback at nemerle.org feedback at nemerle.org
Sun Jan 21 20:39:12 CET 2007


The following issue has been CLOSED
======================================================================
<http://nemerle.org/bugs/view.php?id=829> 
======================================================================
Reported By:                d
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   829
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Resolution:                 open
Fixed in Version:           
======================================================================
Date Submitted:             01-20-2007 20:15 CET
Last Modified:              01-21-2007 20:39 CET
======================================================================
Summary:                    Methods and properties can't have the same names
Description: 
class C {
  Test : int { get { 1 } }
  Test () : int { 1 }
}
// error: method C.Test() : int redefined in `C'
// error:   first definition here as property `C.Test : int'

// Is that by design ? If so - what's the rationle behind it ?
// Makes no sense to me.
======================================================================

----------------------------------------------------------------------
 nazgul - 01-20-07 20:28 
----------------------------------------------------------------------
This is by design:

1) code like this  def x = C().Test;  is ambiguous
2) it is usually an error if you don't know what construct you want to
use: property or method

----------------------------------------------------------------------
 d - 01-20-07 20:37 
----------------------------------------------------------------------
Wouldn't a warning be enough ? Feel free to close the issue if you think
this should stay the way it is.

----------------------------------------------------------------------
 nazgul - 01-21-07 20:39 
----------------------------------------------------------------------
Closing - it is a good feature to prevent users from such an ugly design of
having  same named methods/fields/properties  - overloading makes sense
only when you are giving the actual arguments and their type can influence
the resolving algorithm.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
01-20-07 20:15 d              New Issue                                    
01-20-07 20:28 nazgul         Note Added: 0001617                          
01-20-07 20:28 nazgul         Status                   new => feedback     
01-20-07 20:28 nazgul         Summary                  Methods and properties
can't have the same names => Methods and properties can\'t have the same names
01-20-07 20:28 nazgul         Description Updated                          
01-20-07 20:37 d              Note Added: 0001618                          
01-21-07 20:39 nazgul         Status                   feedback => closed  
01-21-07 20:39 nazgul         Note Added: 0001624                          
======================================================================




More information about the bugs mailing list