Tom,
Then what will you do when naming operations in a class? Is it right that
care has to be taken in order not to conflict with other classes?

Say, I have a Person class where I want to define an operation "getName".
Is it wise to name it "getPersonName" instead?

I notice that FiniteMap always names operations and functions xxxFM,
although that looks ugly to me. Is that a general good thing to do when
naming operations?

Ben.




                                                                                       
                                                
                      Tom Pledger                                                      
                                                
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]            
                                               
                      .nz>                     cc:       [EMAIL PROTECTED]             
                                              
                      Sent by:                 Subject:  Re: [Haskell] Annoying naming 
clashes                                         
                      [EMAIL PROTECTED]                                                
                                                
                      askell.org                                                       
                                                
                                                                                       
                                                
                                                                                       
                                                
                      06/11/2004 09:27                                                 
                                                
                      PM                                                               
                                                
                                                                                       
                                                




[EMAIL PROTECTED] wrote:

>Hi, when writing haskell code. It is so annoying that name clashes keep
>happening.
>
>I have to be careful about the data constructor names, about the class
>names, about the class member names.
>
>[...]
>
>As a novice haskell programmer, I might be missing something here though.
>If somebody can kindly give me some instruction of how to work with names,
>appreicate it a lot!
>

Hi.

Try using small modules and qualified names.

    module Illumination where
    data Illumination = Dark | Light

    module Weight where
    data Weight = Heavy | Light

    module UseBoth where
    import Illumination
    import Weight
    easyToCarry = (Illumination.Light, Weight.Light)

Regards,
Tom


_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell




This message is intended only for the addressee and may contain information
that is confidential or privileged. Unauthorized use is strictly prohibited
and may be unlawful. If you are not the intended recipient, or the person
responsible for delivering to the intended recipient, you should not read,
copy, disclose or otherwise use this message, except for the purpose of
delivery to the addressee. If you have received this email in error, please
delete and advise us immediately.

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to