hubFS: THE place for F#

. . . are you on The Hub?
Welcome to hubFS: THE place for F# Sign in | Join | Help
in Search

Strange name clash: get_x and x in a module is error, but x and get_x is OK?

Last post 07-02-2008, 14:42 by kyagrd. 0 replies.
Sort Posts: Previous Next
  •  07-02-2008, 14:42 6280

    Strange name clash: get_x and x in a module is error, but x and get_x is OK?

    I am using F# Version 1.9.4.17 on Visual Studion 2008.

    When I try the following:

    let get_x () = 1
    let x = 1

    I get an error message as follows:

    Error 1 This module contains values 'x' and 'get_x'. Two values in a module may not have names distinguished only by the suffix 'get_'. H:\Personal\Visual Studio 2008\Projects\Project2\Project2\main.fs 25 5 

    Above straing error is due to the current implementation of F# name bindigns which binds 'x' internally as a method named "int get_x()".

    The really strange part is that the F# system does not complain and compiles well just by changing the order or 'x' and 'get_x' as follows:

    let x = 1
    let get_x () = 1

     

    Disallowing 'get_x' and 'x' in same module is not the most elegant implementation.  Moreover, allowing them in the other order seems really not a right implementation.

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems