Version française
Home     About     Download     Resources     Contact us    
Browse thread
to have labels or not
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Rogoff <bpr@b...>
Subject: Re: to have labels or not
On Fri, 17 Mar 2000, Jan Brosius wrote:
> My personal choice is not to use labels at all because it makes the readable
> code  too big, it is better I think  to use meaningful words and within
> comments to clarify the types of the functions.

I don't believe this argument. I got the labeled and nonlabeled 
versions of Markus Mottl's PCRE library and looked at their respective 
sizes; the labeled versions had significantly less code (10-20% I think) 
than the unlabeled. It also dealt better with that name mess caused by 
optional parameters in the old PCRE interface causing it to read better 
IMO. 

I agree that labels seem heavy for some uses, and depending on your coding
style they may not be for you.

Making the labels single letter names seems like a bad idea. How do we
distinguish "file" and "function" for example? I like "fn" but "func" is 
OK too. 

I like ":", and I'm not sure I want to give up $, %, or & for labels. Its 
nice to be able to use these as infixes, whether or not infixes are good
for programming-in-the-large. 

I also agree that the error messages are difficult, but that's orthogonal
to labels, call it the "price of type inference".

Whatever happened to those other O'Labl features that haven't made it into 
OCaml yet? In particular, polymorphic methods.

> I think I would never use the "label on " option.

Never say never.

> function x -> ..   could be shortened  by : \x ->.....  I think and the use
> of [`a] instead of  `a list and the use of  list comprensions as in Haskell
> could shorten the readable code and maintain readability.

Actually `a is another issue, and elsewhere it was rightly suggested that
it be made illegal ;-). OK, seriously, you can use CamlP4 to get
comprehension syntax, and but it doesn't work yet with labels so you
won't have a chance to try them if you need P4.

-- Brian