[Template-haskell] Release

Andre Pang ozone@vergenet.net
Fri, 23 May 2003 19:26:12 +1000


On Friday, May 23, 2003, at 06:01  PM, Simon Peyton-Jones wrote:

> My suggestion for resolving the occasional clash (and there were only a
> handful) would be to change the constructor name.  For example, we have
> a let form in Exp and in Stmt.  Let's just give one a different name.
> The Stmt type is much less used than the Exp type. Perhaps 'Bind',
> 'Let', 'NoBind' and 'Par' are a bit cryptic because Stmts are so much
> less common, so perhaps 'LetStmt' or 'StmtLet' would indeed be a good
> choice.  Similarly for Foreign, the constructor 'ImportForeign' or
> 'ForImport' seems good; plain 'Import' is rather cryptic.
>
> But for the big hitters, Exp, RHS, Dec, Pat, Typ, my personal 
> preference
> would be for short constructor names.

IMHO, if a choice is to be made between shorter, possibly more cryptic 
names vs longer but more descriptive names, I'll nearly always prefer 
the route of having a longer, more descriptive name.  It makes reading 
code that much easier, and if you're getting tired of typing out a 
longer name, this is an area where the text editor should help you.  
(e.g. M-/ in emacs).  Now that I've said that ...

I think Manuel's main objection to the old naming scheme was the 
inconsistency that some constructors were tagged with the type and some 
weren't, so that there was "Let" and "LetS" instead of, e.g. "LetExp" 
and "LetStmt".

Perhaps think a good compromise would be to explicitly tag each 
constructor with the data type, but instead of using a three-letter 
suffix for Exp, Dec, Pat, Typ, Stmt, use a one-letter suffix (E, D, P, 
T, S).  From what I've seen, it looks like those five types are the 
"big ones" which are used a lot, and having only five one-letter 
abbreviations makes remembering what they're for manageable.

I'd also remove the "Lit" suffix from the Lit type completely, so 
instead of CharLit, StringLit etc, it would revert back to Char & 
String -- it's completely unambiguous what those constructors represent.

Otherwise, I think for the other constructors, leave them as their 
current long name, as Ian has edited it -- leaving out their suffix 
them would make them too obtuse.

> I would like to see the type 'Typ' change to 'Type', though!
>
> Changing DotDot to Range is fine with me.

100% agreed on both of these points :).


-- 
% Andre Pang : just.your.average.bounty.hunter