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

Side by Side Diff: lib/core/object.dart

Issue 10974004: Add documentation to the Object class in the core library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Everything in Dart is an [Object]. 6 * Everything in Dart is an [Object].
7 */ 7 */
8 class Object { 8 class Object {
9 /**
10 * Object constructor.
Lasse Reichstein Nielsen 2012/09/24 10:43:18 That's obvious. This constructor is only here beca
Mads Ager (google) 2012/09/24 11:07:15 Done, thanks.
11 */
9 const Object(); 12 const Object();
10 13
14 /**
15 * The equality operator.
Lasse Reichstein Nielsen 2012/09/24 10:43:18 We'll probably want to add something about equival
16 *
17 * The default behavior for all [Object]s is to return true if and
18 * only if [:this:] and [other] are the same object.
19 *
20 * If a subclass overrides the equality operator it should override
21 * the [hashCode] method as well to maintain consistency.
22 */
11 bool operator ==(other) => identical(this, other); 23 bool operator ==(other) => identical(this, other);
12 24
25 /**
26 * Get a hash code for this object.
27 *
28 * All objects have hash codes. Hash codes are guaranteed to be the
29 * same for objects that are equal when compared using the equality
30 * operator [:==:]. Other than that there are no guarantees about
31 * the hash codes. They will not be consistent between runs and
32 * there are no distribution guarantees.
Lasse Reichstein Nielsen 2012/09/24 10:43:18 I really want to promise that hash-codes are 32-bi
Mads Ager (google) 2012/09/24 11:07:15 I don't see a problem with using 32-bit unsigned i
33 *
34 * If a subclass overrides [hashCode] it should override the
35 * equality operator as well to maintain consistency.
36 */
13 external int hashCode(); 37 external int hashCode();
14 38
39 /**
40 * Returns a string representation of this object.
41 */
15 external String toString(); 42 external String toString();
16 43
44 /**
45 * [noSuchMethod] is invoked when users invoke a non-existant method
46 * on an object. The name of the method and the arguments of the
47 * invocation are passed to [noSuchMethod]. If [noSuchMethod]
48 * returns a value, that value becomes the result of the original
49 * invocation.
50 *
51 * The default behavior of [noSuchMethod] is to throw a
52 * [noSuchMethodError].
53 */
17 external void noSuchMethod(String name, List args); 54 external void noSuchMethod(String name, List args);
Mads Ager (google) 2012/09/24 10:13:13 The void return type is confusing here. Should we
Lasse Reichstein Nielsen 2012/09/24 10:43:18 If anything, we should change it to Dynamic. And y
Mads Ager (google) 2012/09/24 11:07:15 I have changed it to Dynamic.
18 55
56 /**
57 * Returns the representation of the runtime type of the object.
Lasse Reichstein Nielsen 2012/09/24 10:43:18 the representation -> a representation. We don't g
Mads Ager (google) 2012/09/24 11:07:15 Done.
58 */
19 external Type runtimeType(); 59 external Type runtimeType();
20 } 60 }
21 61
62 /**
63 * Representation of the runtime type of an object.
Lasse Reichstein Nielsen 2012/09/24 10:43:18 Just "Representation of a type." You can get repre
Mads Ager (google) 2012/09/24 11:07:15 Done.
64 */
22 abstract class Type {} 65 abstract class Type {}
23 66
24 /** 67 /**
25 * Check whether two references are to the same object. 68 * Check whether two references are to the same object.
26 */ 69 */
27 bool identical(Object a, Object b) => a === b; 70 bool identical(Object a, Object b) => a === b;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698