OCaml Forge
SCM

Detail: [#658] Bad indentation of "let module"

Feature Requests: Browse | Download .csv | Monitor

[#658] Bad indentation of "let module"

Date:
2010-06-04 08:41
Priority:
3
State:
Open
Submitted by:
Julien Signoles (signoles)
Assigned to:
Nobody (None)
Component:
Operating System:
Product:
 
Summary:
Bad indentation of "let module"

Detailed description
All in the title...

let x =
let module M =
struct
end
in
0

Followup

Message
Date: 2010-10-22 16:57
Sender: Sam Steingold

http://www.cygwin.com/acronyms/#PTC
Date: 2010-10-22 15:37
Sender: Julien Signoles

I agree

let x =
let module M = struct
end in
0

is acceptable.

However, I use quite big functor applications with "let module" too:

let x =
let module F =
F(struct
(* a quite long and complex structure *)
end)

1) I don't like to put F in the same line than "let module" because I don't see it quickly and thus I forget than the module is a functor application;
2) I don't like to loss 4 extra spaces while 80-column are not so large;
3) I don't agree with your "semantic" argument since module expressions are not always attached to the "module" keyword (anonymous module exists).

But I don't want to enter into an indentation fight. If you think that it is better like that: ok, you're the master of tuareg-2 ;-). But please provide at least a way to customize this behavior.
Date: 2010-10-22 14:47
Sender: Sam Steingold

semantically, struct/end are "subordinate" to module, so they should not align behind it.
if you are concerned with space and want to avoid too much indentation, do this:
let x =
let module M = struct
end in
0
I find the above eminently readable and convenient.
Date: 2010-10-21 22:01
Sender: Julien Signoles

I think it would be **much** better if struct/end aligned with let:
1) when you quicky look at your code, there seems 6 indents and not 2
2) you loss 6-2=4 characters on your 80-columns line.
Date: 2010-10-21 21:11
Sender: Sam Steingold

I am perfectly happy with the indentation I observe, i.e., struct/end aligned with module.

Attached Files:

Changes:

Field Old Value Date By
assigned_tosds2010-10-22 16:57sds
summaryBad indentation of "let module"2010-10-22 16:57sds
summaryBad indentation of "let module"2010-10-22 16:57sds
summaryBad indentation of "let module"2010-10-22 14:47sds
assigned_tonone2010-10-21 21:21sds
summaryBad indentation of "let module"2010-10-21 21:21sds
summaryBad indentation of "let module"2010-10-21 21:11sds