-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEP-0007 Type-Safe Limited Collections #622
Conversation
This needs rebasing forward due to some recent merges. |
Rebased. |
this needs some more rebasing... sorry I didn't look in here before, and just cleaned up dfmc/optimization, management, flow-graph, debug-back-end... should be straightforward to rebase... I'll look into that after I got my visualization branch up and running again... (which is wip, #660, and a (currently) local branch). |
Rebased. |
now that the visualization has landed, could you please rebase once more? |
Rebased. |
from the DEP, which I just read: |
and unfortunately this pull request needs yet another rebase.. I'll continue to look into the actual code and hope to merge it soon. @housel do you have an opinion on DEP7, and/or these commits here? |
@@ -842,6 +843,7 @@ define as-type-estimate-rules | |||
class: ^limited-collection-class(t), | |||
concrete-class: ^limited-collection-concrete-class(t), | |||
of: as(<type-estimate>, ^limited-collection-element-type(t)), | |||
// *** Should add element-type-fill? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, it should not be relevant for the typist, or should it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how it would be relevant, but I'm not the typist expert. I'll go ahead and remove that comment.
This is because, as I mention in the element-type-fill doc, the user can introduce a fill: keyword in a custom subclass of . element-type-fill is applicable to all collections, not just the limited collections implemented as part of OD, because it is may be necessary when processing a collection into something new, or layering something on top of another collection. So I think it is reasonable for the developer of, say, a or class to support an element-type-fill method to put it on the same footing as . The question is how to distinguish whether a given collection is “fillable” in the abstract sense. The guide I used in the DEP is whether the class supports the fill: init-keyword. But there isn’t really a way to tell if that keyword is supported for an arbitrary class. On Feb 10, 2014, at 10:30 AM, Hannes Mehnert [email protected] wrote:
|
could you compile the dylan library as it is in master and count the generic calls (by passing |
Compiling a simple app results in a build of the The master The DEP-0007 |
@BarAgent thanks for the statistics. It would be great if we can qualify the cause of the increase. My proposal is to separate the I'm also in favor of a diff of the DFM of all methods where a new GF dispatch was introduced... |
The (For future reference, the command I am using to do the count is I also took a look at the diff in deque.dfm and string.dfm. Many of the new "generic" references seem to be new type-checks in the DEP code. There are also new copy-down methods for The DEP-0007 branch has 2250 CALLg and 3259 CALLi (a ratio of .69, or 41% generic). |
array, extras, multidimensional-array, sequence, stretchy-vector, and table look harmless. |
…does not need to be the element type of the collection if “default:” is used. Collections test suite was too strict with add! and remove!: OD implements them on <collection>, not just <sequence>.
…and repeated slots. “-with-fill” classes removed. More correct array handling in library code. Corrected implementation of “element” to allow element-not-found default of different class than element type. Removed default value for “default-fill:” keyword argument to “limited”. Neither the DRM nor the DEP calls for it.
Correctly initializes element-type-fill of concrete limited collection classes. Fixes <stretchy-vector> resizing to employ the element-type-fill when increasing collection size. Creating limited <string> results in limited <byte-string>. Removed redundant code. Added tests.
More precise fill: keyword defaults for limited collections. Declare missing shared symbol.
Removes fill value defaults from DFMC limited types; now they match the run-time limited types. Adds additional type-checking.
Resolves a case where user needed to set a default-fill when he shouldn’t have needed to.
Shaved off about 50 CALLg's. It all looks good to me. The remaining new CALLg's seem to be from copy-downs, additional type-checking that should have been in there in the first place, and the mechanism for picking between the new concrete limited collection classes. |
could you elaborate on that with a new set of statistics, please? |
Here are the current differences: DEP CALLg counts
Master CALLg counts
Mostly the same, but limited-vector.dfm is improved, string.dfm and unicode-string.dfm are slightly improved, and type.dfm is almost back to where it was in master. There are a few new CALLg occurrences in class.dfm, generic-function.dfm, and sequence.dfm, where CALLg replaces APPLYg, but that does not change the dispatch situation. |
I'd be more happy if the string/unicode-string and limites-array/limited-stretchy-vector are further reduced... and will look into generic-function just to make sure it is fine. |
I've looked over limited-stretchy-vector.dfm a couple times. The new CALLg are literally all As for unicode-string.dfm, there is exactly one new |
I ran a master: 622: Thus, I'd say the performance impact is negligibly. @housel @waywardmonkeys if you don't have any showstoppers, I'm happy to merge it this sunday (23rd February). |
DEP-0007 Type-Safe Limited Collections
@BarAgent unfortunately there's a bootstrap issue: a released compiler cannot build library dylan:
thus I'll revert the commit.. |
(old compiler [release] cannot build dylan library anymore) Revert "Merge pull request dylan-lang#622 from BarAgent/dep-0007" This reverts commit 28e4204, reversing changes made to 0132fff.
From the DEP-0007 document (http://opendylan.org/proposals/dep-0007.html):
To improve type safety of collections and particularly limited collections, this DEP adds a
default-fill:
keyword argument to limited collection classes and anelement-type-fill
andelement-type
getter to all collections.The reference implementation is now complete and tested and is ready to be accepted or reject per DEP guidelines.