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

Issue 10534089: Add experimental expando support. (Closed)

Created:
8 years, 6 months ago by kasperl
Modified:
8 years, 6 months ago
Reviewers:
sra1, Ivan Posva
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add experimental expando support. R=iposva@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=8522

Patch Set 1 #

Total comments: 4

Patch Set 2 : Add test case. #

Total comments: 4

Patch Set 3 : More hacking. #

Patch Set 4 : Improve const expando tests. #

Total comments: 2

Patch Set 5 : Fix comment and merge. #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+208 lines, -4 lines) Patch
A corelib/src/expando.dart View 1 2 3 4 1 chunk +38 lines, -0 lines 3 comments Download
M lib/compiler/implementation/lib/core.dart View 1 chunk +1 line, -0 lines 0 comments Download
M lib/compiler/implementation/lib/js_helper.dart View 1 chunk +16 lines, -0 lines 2 comments Download
M lib/compiler/implementation/lib/mock.dart View 1 2 1 chunk +40 lines, -0 lines 0 comments Download
M samples/tests/samples/samples.status View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M tests/corelib/corelib.status View 1 chunk +2 lines, -3 lines 0 comments Download
A tests/corelib/expando_test.dart View 1 2 3 1 chunk +110 lines, -0 lines 2 comments Download

Messages

Total messages: 8 (0 generated)
kasperl
8 years, 6 months ago (2012-06-11 10:55:46 UTC) #1
Ivan Posva
https://chromiumcodereview.appspot.com/10534089/diff/1/corelib/src/expando.dart File corelib/src/expando.dart (right): https://chromiumcodereview.appspot.com/10534089/diff/1/corelib/src/expando.dart#newcode5 corelib/src/expando.dart:5: interface Expando<T> default ExpandoImplementation<T> { Private implementation? https://chromiumcodereview.appspot.com/10534089/diff/1/corelib/src/expando.dart#newcode17 corelib/src/expando.dart:17: ...
8 years, 6 months ago (2012-06-11 11:18:33 UTC) #2
Ivan Posva
https://chromiumcodereview.appspot.com/10534089/diff/6001/tests/corelib/expando_test.dart File tests/corelib/expando_test.dart (right): https://chromiumcodereview.appspot.com/10534089/diff/6001/tests/corelib/expando_test.dart#newcode13 tests/corelib/expando_test.dart:13: } Currently you are only testing adding a specific ...
8 years, 6 months ago (2012-06-11 12:08:08 UTC) #3
kasperl
PTAL. https://chromiumcodereview.appspot.com/10534089/diff/6001/tests/corelib/expando_test.dart File tests/corelib/expando_test.dart (right): https://chromiumcodereview.appspot.com/10534089/diff/6001/tests/corelib/expando_test.dart#newcode13 tests/corelib/expando_test.dart:13: } On 2012/06/11 12:08:08, Ivan Posva wrote: > ...
8 years, 6 months ago (2012-06-11 12:44:39 UTC) #4
Ivan Posva
LGTM -ip https://chromiumcodereview.appspot.com/10534089/diff/5003/corelib/src/expando.dart File corelib/src/expando.dart (right): https://chromiumcodereview.appspot.com/10534089/diff/5003/corelib/src/expando.dart#newcode19 corelib/src/expando.dart:19: * [Expando]s with the same name does ...
8 years, 6 months ago (2012-06-11 13:54:37 UTC) #5
kasperl
https://chromiumcodereview.appspot.com/10534089/diff/5003/corelib/src/expando.dart File corelib/src/expando.dart (right): https://chromiumcodereview.appspot.com/10534089/diff/5003/corelib/src/expando.dart#newcode19 corelib/src/expando.dart:19: * [Expando]s with the same name does not On ...
8 years, 6 months ago (2012-06-12 05:16:05 UTC) #6
sra1
I need something like this for some dart:html APIs. The API and documentation are missing ...
8 years, 6 months ago (2012-06-12 07:10:26 UTC) #7
kasperl
8 years, 6 months ago (2012-06-14 15:33:44 UTC) #8
On 2012/06/12 07:10:26, sra1 wrote:
> I need something like this for some dart:html APIs.
> 
> The API and documentation are missing a few details.  If you can address my
> comments in a follow-up CL I should be able to use Expando.
> Currently I have my own expando-like mechanism which I will otherwise use
until
> Expando matures.
> 
>
https://chromiumcodereview.appspot.com/10534089/diff/5004/corelib/src/expando...
> File corelib/src/expando.dart (right):
> 
>
https://chromiumcodereview.appspot.com/10534089/diff/5004/corelib/src/expando...
> corelib/src/expando.dart:6: * An [Expando] allows adding new properties to
> objects.
> It does not look like adding properties to an object.
> I can't start writing obj.foo or obj[foo] where foo is the Expando.
> I have to write foo[obj] which looks more like an identity map.
> So why is this called 'Expando' rather than 'IdentityMap' or something
similar?
> 
> Ultimately this is a map from instances to values with some lifetime
guarantees.
> The values attached to an object via an Expando will be GC-ed if the object is
> GC-ed and is the only reference to the value is via the Expando.  It is an
> implementation detail that the information directly hangs off the instance.
> 
>
https://chromiumcodereview.appspot.com/10534089/diff/5004/corelib/src/expando...
> corelib/src/expando.dart:17: * Creates a new [Expando]. The optional name is
> only used for
> 'only used' - I'm confused.
> If I create two const [Expando]s with the same name, the behaviour is not
> (obviously) specified in this one-sentence comment.
> 
> Please spell out the const and non-const cases.
> Significant different behaviors deserve separate sentences.
> 
> The comment must at least explain the coding pattern for how a package should
> use the API to add a field/expando that does not conflict with other packages.
> 
>
https://chromiumcodereview.appspot.com/10534089/diff/5004/corelib/src/expando...
> corelib/src/expando.dart:27: * [null].
> Explain when the call will fail,
> 
>
https://chromiumcodereview.appspot.com/10534089/diff/5004/lib/compiler/implem...
> File lib/compiler/implementation/lib/js_helper.dart (right):
> 
>
https://chromiumcodereview.appspot.com/10534089/diff/5004/lib/compiler/implem...
> lib/compiler/implementation/lib/js_helper.dart:573: if (object is bool ||
object
> is num || object is String) {
> This predicate is in the wrong place.  A public API that uses the API needs to
> be doing the check, and possibly exporting the predicate.
> 
>
https://chromiumcodereview.appspot.com/10534089/diff/5004/lib/compiler/implem...
> lib/compiler/implementation/lib/js_helper.dart:581: if (object is bool ||
object
> is num || object is String) {
> Ditto.
> 
>
https://chromiumcodereview.appspot.com/10534089/diff/5004/tests/corelib/expan...
> File tests/corelib/expando_test.dart (right):
> 
>
https://chromiumcodereview.appspot.com/10534089/diff/5004/tests/corelib/expan...
> tests/corelib/expando_test.dart:64: var e0 = const Expando<int>('horse');
> Add 'difficult' names:
> 'prototype'
> 'toString'
> '__proto__'
> 
>
https://chromiumcodereview.appspot.com/10534089/diff/5004/tests/corelib/expan...
> tests/corelib/expando_test.dart:94: testIllegal() {
> Illegal cases make the Expando API difficult to use.
> 
> My use case for dart:html is to walk the object graph and translate general
> forms of List<T> and Map<K,V> to base representations.  I need a private
> 'visited' flag, for which an Expando is the only feasible solution to date. 
How
> do I know when I should use and when I should avoid my 'visited' Expando?
> 
> Please add a public legality predicate so that general object graph traversal
> can be written without knowledge of implementation details.

Thanks for the feedback, Stephen. I'll try to work with Ivan to address it and
to get this to run on the VM too.

Powered by Google App Engine
This is Rietveld 408576698