[M3devel] Shorthand type declarations?

Rodney M. Bates rodney_bates at lcwb.coop
Wed Feb 3 04:37:33 CET 2010



Chris wrote:
> Alright, I'm finally getting the hang of things.
> 
> One quick question..
> 
> Is there a shorthand for declaring a whole bunch of types as one type? i.e....
> 
> TYPE 
>   Window, Pixmap, Cursor = unsigned_int;
> 
> Or something similiar?
> 
> Doing this
>  TYPE
>    Window = unsigned_int;
>    Pixmap = unsigned_int;
>    Cursor = unsigned_int;
>    etc...
> Adds up to whole lot of typing.(No pun intended)

Unfortunately, this is the shortest you can get.  I suppose the language designers
thought that, while a whole lot of variables with the same type were a likely
case:

   VAR x, y, z, u, v, w, h, i, j, h, ... : INTEGER;   ,

that more than just a few type names that are synonyms for the same type would not be common.

You may think me certifiably masochist, but I go the more longhanded way and write:

  TYPE Window = unsigned_int;
  TYPE Pixmap = unsigned_int;
  TYPE Cursor = unsigned_int;   ,

sacrificing writeability in favor of readability.  (Yes, I repeat VAR and CONST too,
almost every time.


> 
> Any tips would be most welcome.
> 



More information about the M3devel mailing list