[erlang-questions] Style wars: junk comments
Thu Sep 13 07:39:36 CEST 2012
I've been following this whole thread with mild amusement and I am
siding with Richard on this.
I would go the extra mile to and say, documentation that is not
executable to test for correctness is sure to rot.
So, on top of the mind-cycle-wasting comments which section the source
file in obvious ways, we have these others which just state the
obvious and then go bad when the code changes.
In general I get a strong feeling that people who don't feel
comfortable with the language, riddle it with sectioning comments in
order to feel some form of control.
I can't be the only one who read The Pragmatic Programmer: From
Journeyman to Master, Clean Code and The Clean Coder.
On Wed, Sep 12, 2012 at 11:59 PM, Richard O'Keefe <ok@REDACTED> wrote:
> On 12/09/2012, at 11:48 PM, Fred Hebert wrote:
>> This is the approach I like the most.
>> It's something I picked up when working with Scheme, where functions can contain the definitions of their helpers within them, which made the code much clearer to me.
> Scheme and ML have features that make this rather more useful
> than it is in languages like Clean and Haskell. In ML you can
> <private definitions>
> <public definitions>
> and this has the effect that the things defined in
> <private definitions> are visible in <public
> definitions>, but not outside, while the things
> defined in <public definitions> are visible outside.
> For example, you might have
> fun rebalance t = ...
> fun add k v t = ...
> fun del k t = ...
> Scheme lets you hack this by doing
> (define add)
> (define del)
> (letrec ((rebalance (lambda (t) ...))
> (set! add (lambda (k v t) ...))
> (set! del (lambda (k t) ...))
> I see this quite a lot in Scheme.
> If Joe's still thinking about Erlang 2, I hope he'll consider
> the functionality of local-in-end.
> erlang-questions mailing list
More information about the erlang-questions