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

should default constructors use field types as their argument types? #250

Closed
JeffBezanson opened this issue Nov 2, 2011 · 3 comments · May be fixed by JuliaDiff/ChainRules.jl#302
Closed
Assignees

Comments

@JeffBezanson
Copy link
Member

Currently the default constructor for:

type Foo
  x::A
  y::B
end

will have the signature Foo(Any,Any), and whatever you pass will be converted (as with any field assignment). Maybe we should change this to Foo(A,B) to make it harder to make unintended objects.

@ghost ghost assigned JeffBezanson Nov 2, 2011
@StefanKarpinski
Copy link
Member

+1

@StefanKarpinski
Copy link
Member

This will not only be safer but also way easier to explain (usually a good sign). If someone wants conversion semantics, they can write a custom constructor function. It's easy to do if you want it.

JeffBezanson added a commit that referenced this issue Nov 2, 2011
… argument types.

tests pass, but beware of things potentially breaking/changing.
@JeffBezanson
Copy link
Member Author

OK, done. I only needed to change one type declaration. Be on the lookout for others.

cmcaine added a commit to cmcaine/julia that referenced this issue Sep 24, 2020
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Oct 11, 2021
Introduce four different weight types with different bias correction factors for variance, covariance and standard deviation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants