Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Issue 11028138: Fields, getters and setters documented as properties. (Closed)

Created:
8 years, 2 months ago by Johnni Winther
Modified:
8 years, 2 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Fields, getters and setters documented as properties. Committed: https://code.google.com/p/dart/source/detail?r=13611

Patch Set 1 #

Total comments: 30

Patch Set 2 : Updated cf. comments + UI bug fixed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+295 lines, -109 lines) Patch
M pkg/dartdoc/lib/dartdoc.dart View 1 7 chunks +272 lines, -94 lines 0 comments Download
M pkg/dartdoc/lib/mirrors.dart View 1 chunk +5 lines, -0 lines 0 comments Download
M pkg/dartdoc/lib/src/client/client-shared.dart View 1 chunk +12 lines, -10 lines 0 comments Download
M pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart View 1 chunk +2 lines, -1 line 0 comments Download
M pkg/dartdoc/static/styles.css View 1 3 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Johnni Winther
8 years, 2 months ago (2012-10-11 10:07:00 UTC) #1
Bob Nystrom
https://codereview.chromium.org/11028138/diff/1/pkg/dartdoc/lib/dartdoc.dart File pkg/dartdoc/lib/dartdoc.dart (right): https://codereview.chromium.org/11028138/diff/1/pkg/dartdoc/lib/dartdoc.dart#newcode1012 pkg/dartdoc/lib/dartdoc.dart:1012: final staticGetters = new Map<String,MemberMirror>(); Style nit: there should ...
8 years, 2 months ago (2012-10-11 17:04:21 UTC) #2
Lasse Reichstein Nielsen
lgtm https://codereview.chromium.org/11028138/diff/1/pkg/dartdoc/lib/dartdoc.dart File pkg/dartdoc/lib/dartdoc.dart (right): https://codereview.chromium.org/11028138/diff/1/pkg/dartdoc/lib/dartdoc.dart#newcode1012 pkg/dartdoc/lib/dartdoc.dart:1012: final staticGetters = new Map<String,MemberMirror>(); I'm getting less ...
8 years, 2 months ago (2012-10-12 09:47:26 UTC) #3
Johnni Winther
https://codereview.chromium.org/11028138/diff/1/pkg/dartdoc/lib/dartdoc.dart File pkg/dartdoc/lib/dartdoc.dart (right): https://codereview.chromium.org/11028138/diff/1/pkg/dartdoc/lib/dartdoc.dart#newcode1012 pkg/dartdoc/lib/dartdoc.dart:1012: final staticGetters = new Map<String,MemberMirror>(); On 2012/10/12 09:47:26, Lasse ...
8 years, 2 months ago (2012-10-12 11:15:53 UTC) #4
Bob Nystrom
https://codereview.chromium.org/11028138/diff/1/pkg/dartdoc/lib/dartdoc.dart File pkg/dartdoc/lib/dartdoc.dart (right): https://codereview.chromium.org/11028138/diff/1/pkg/dartdoc/lib/dartdoc.dart#newcode1012 pkg/dartdoc/lib/dartdoc.dart:1012: final staticGetters = new Map<String,MemberMirror>(); On 2012/10/12 11:15:53, Johnni ...
8 years, 2 months ago (2012-10-12 16:09:02 UTC) #5
Lasse Reichstein Nielsen
8 years, 2 months ago (2012-10-15 09:16:20 UTC) #6
https://codereview.chromium.org/11028138/diff/1/pkg/dartdoc/lib/dartdoc.dart
File pkg/dartdoc/lib/dartdoc.dart (right):

https://codereview.chromium.org/11028138/diff/1/pkg/dartdoc/lib/dartdoc.dart#...
pkg/dartdoc/lib/dartdoc.dart:1106: MemberMirror setter = setters[name];
On 2012/10/12 16:09:02, Bob Nystrom wrote:
> On 2012/10/12 09:47:26, Lasse Reichstein Nielsen wrote:
> > I disagree. I can't read the type of 'getter' from the right-hand-side, and
> > really appreciate (and demand!) the type be there to inform me.
> 
> That's the tool's job! :) 

I'm very much in the "must be readable when printed" faction here. You can't
control which tools are used to view or edit the code, so it should be readable
in all of them.

> Programmers shouldn't have to manually add redundant
> information to their code that can be automated.

By all means use a pre-processor to add the types before committing :)
 
> One thing I'm very sensitive to is the aesthetics of Dart code. People will
> judge the language by how a page of code in it looks. To anyone coming from
> JavaScript, Python, C#, or pretty much any language except Java, type
> annotations on locals are a very strong turn-off.

That might be my problem - I come from both (enterprise) Java and JavaScript,
and I find Java easier to read. Not easier to write, but that wasn't the design
intent of Java - it is designed to always be readable by making nothing
implicit. 
 
> I don't think the (negligible) additional information that local type
annotation
> provides is worth alienating potential users.

It's not negligible to me - I can't read and understand the code without that
information. If I had written the code originally, or edited it, or if I had had
to read the entire file (or library) first, I would probably understand it, but
as an outsider, the code is simply not understandable without more information. 
You can put the extra information in the variable name (setterMirror), or you
can add it as a type assertion (MemberMirror setter, giving you a shorter name
elsewhere), I won't care, but omitting it isn't good for readability, and
therefore not good for maintainability.
If the code isn't just a quick hack (which it is great that we also support),
maintainability is more important than ... pretty much everything except
correctness.

> > Verbose, yes, but the pain to me is when it's not there, and I have to think
> > every time I read the line.
>

Powered by Google App Engine
This is Rietveld 408576698