-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also renamed svd.jl to linalg.jl in preparation for DataMatrix type.
- Loading branch information
1 parent
f8282e8
commit 5effea5
Showing
4 changed files
with
50 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5effea5
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.
This commit fixes all of the ambiguity warnings generated by the DataFrames package.
There is still one warning about an ignored attempt to redefine
NARule
. As far as I can see, someone tried to use different capitalizations ofNARule
to mean different things. I'll resolve that at some point, although possibly by removing the entire fieldnaRule
fromDataVec
's.5effea5
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.
!!!!! Great, John !!!!!
5effea5
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 am pretty happy about this as well.
5effea5
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.
Yes, this is great, John. Question: do you feel like this was an annoying and somewhat pointless hassle, or did the ambiguity warnings serve a purpose? I.e. did this make the code better? Also, those classifications of operators are rather useful and should maybe be made more generally available for metaprogramming purposes.
cc: @JeffBezanson. This relates to the "operator dispatch" idea I told you about the other day. These sets of operators would presumably correspond to operator types and you would add methods
apply
for the corresponding operator types instead of using@eval
to loop over all the individual operators. We would have to get the operator classification hierarchy correct, but I think that's doable.5effea5
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.
For NA's, the ambiguity warnings were extremely valuable in retrospect, since they indicated places where NA's were poisoning things inappropriately. They're frustrating at the time of creation, but they did at least make it clear how to get NA's to work correctly.
I agree that whatever metaprogramming module we eventually develop should contain those kind of classifications of operators. I was just starting to write a
test_type()
function that would do something similar for new types: add all basic operators and confirm that things likeprint
,show
, andrepl_show
have explicit definitions.I'd like to hear more about the operator dispatch idea.
5effea5
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.
The basic idea for operator dispatch – and this is a possibly whackadoodle, bad idea, but it seems interesting – is that you would have a type classification on functions and could, e.g., declare that
-::UnaryOperator
(somehow, totally unclear how, maybe- = UnaryOperator()
to create a new generic function of typeUnaryOperator
?). Then later, instead of doing this:you could write this instead:
In the absence of a specific definition of
-(::NAType)
, this dispatch rule would get invoked when-NA
occurred, and you'd get the desired behavior.This idea has a few effects and consequences. In some way that we haven't really fully thought through yet, it unifies types and functions. This unification may or may not be compatible with the way that some types can currently be invoked as constructors. It also makes function syntax overloadable, which is Jeff's biggest qualm about it – it makes the worst case performance of method dispatch potentially much, much worse, without significant cleverness. Finally, it seems like it would require multiple inheritance to make it fully useful since most operators would need to be in multiple overlapping classes of operators. Since multiple inheritance is something we're not considering until a much later version of Julia because of implementation complexity, this seems like it would relegate operator dispatch to at least that far into the future. But considering it now is not a bad idea since we might be able to leave room for it.
5effea5
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've been thinking more about operator dispatch. I still think the idea is awesome, but keep finding myself needing more and more complex multiple inheritance-like constructs to reason about how operators work (e.g. my recent work on matrix multiplication for DataMatrix). Enumerating some basic properties and making them programmatic in any way still seems valuable. For instance, I've come to think that defining a
@commutative
macro is a little tricky, but that having ais_commutative
test is a clear win for reasoning about operators.