appeal again: discard the syntax of private:, public: static:private{}, public{}, static{}.

Derek Parnell derek at psych.ward
Sat Jun 24 20:53:36 PDT 2006


On Sun, 25 Jun 2006 13:07:14 +1000, Ben Phillips <Ben_member at pathlink.com>  
wrote:

> In article <optbof6t0b23k2f5 at nrage>, Regan Heath says...
>>
>>  private a_type var1;
>>  public static a_type var2;
>>  public static int func1(...)
>>  {
>>  }
>>  private a_type var3;
>>  public int func2(...)
>>  {
>>  }
>>  private static int func3(...)
>>  {
>>  }
>>  public a_type var4;
>>  private a_type var5;
>>  public static int func4(...)
>>  {
>>  }
>>  private static a_type var6;
>>  private a_type var7;
>>  public int func5(...)
>>  {
>>  }
>>  private a_type var8;
>>
>>  private int func6(...)
>>  {
>>  }
>>
>
> This is a terribly biased example against individual protection  
> attributes,
> because that code is organized so poorly. Its illogical to assume that  
> people
> who put a protection attributes on each field/function just randomly  
> glop their
> code together like in your example. I use individual protection  
> attributes, yet
> I still structure my code so the private functions are in one area and  
> the
> public ones in another.

Yes, I did purposely exagerate the issue. But is this really any more  
readable? ...

   private a_type var1;
   private a_type var8;
   private int func6(...)
   {
   }
   private a_type var3;
   private a_type var5;
   private a_type var7;
   private static int func3(...)
   {
   }
   private static a_type var6;
   public int func5(...)
   {
   }
   public int func2(...)
   {
   }
   public a_type var4;
   public static a_type var2;
   public static int func1(...)
   {
   }
   public static int func4(...)
   {
   }


I know its a personal taste question, but to me it has too many 'noise'  
words in it that makes it harder to read and write.

   private {
     a_type var1;
     a_type var8;
     a_type var3;
     a_type var5;
     a_type var7;
     int func6(...)
     {
     }
     static {
       int func3(...)
       {
       }
       a_type var6;
     }
   }

   public {
     a_type var4;
     int func5(...)
     {
     }
     int func2(...)
     {
     }
     static {
       a_type var2;
       int func1(...)
       {
       }
       int func4(...)
       {
       }
     }
   }

just seems neater and more likely to be correctly read and maintained.

Anyhow, I've finished with this topic. Thanks for indulging my ravings.

-- 
Derek Parnell
Melbourne, Australia



More information about the Digitalmars-d mailing list