Skip to content
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

Add dispatch on parametric types in doc #13453

Merged
merged 1 commit into from
Oct 6, 2015
Merged

Add dispatch on parametric types in doc #13453

merged 1 commit into from
Oct 6, 2015

Conversation

matthieugomez
Copy link
Contributor

[av-skip] This issue with type invariance often comes up.

@matthieugomez matthieugomez changed the title Add dispatch on parametric types Add dispatch on parametric types in doc Oct 5, 2015
sqrt(p.x^2 + p.y^2)
end

The correct way to define a method that accepts all arguments of ``Point`` types where ``T`` is a subtype of ``Real`` is::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"of type Point", maybe?

@johnmyleswhite
Copy link
Member

The text is really great, but there probably needs to be more of a transition into this new topic, which seems distinct from the constructors discussed immediately above.


The correct way to define a method that accepts all arguments of ``Point`` types where ``T`` is a subtype of ``Real`` is::

function norm{T <: Real}(p::Point{T})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the convention is to write {T<:Real} to me (though it's hard to be sure...).

@nalimilan
Copy link
Member

Good idea!

@tkelman tkelman added the docs This change adds or pertains to documentation label Oct 5, 2015
@matthieugomez
Copy link
Contributor Author

Thanks for the comments — updated the pull request.

jakebolewski added a commit that referenced this pull request Oct 6, 2015
Add dispatch on parametric types in doc
@jakebolewski jakebolewski merged commit b5bebf2 into JuliaLang:master Oct 6, 2015
tkelman pushed a commit that referenced this pull request Oct 7, 2015
(cherry picked from commit 06b52dd)
ref #13453
@tkelman
Copy link
Contributor

tkelman commented Oct 7, 2015

backported in 7048c40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants