Thread overview | |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 11, 2008 [Issue 2095] New: covariance w/o typechecks = bugs | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2095 Summary: covariance w/o typechecks = bugs Product: D Version: 2.012 Platform: PC URL: http://www.digitalmars.com/webnews/newsgroups.php?art_gr oup=digitalmars.D&article_id=71480 OS/Version: Windows Status: NEW Keywords: spec Severity: normal Priority: P2 Component: www.digitalmars.com AssignedTo: bugzilla@digitalmars.com ReportedBy: terranium@yandex.ru class A{} class B:A{} B[] ba=[new B]; A[] aa=ba; aa[0]=new A; ba[0].methodB(); //ba[0] is expected to be B, but is A -- |
October 10, 2008 [Issue 2095] covariance w/o typechecks = bugs | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2095 terranium@yandex.ru changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fraserofthenight@gmail.com ------- Comment #1 from terranium@yandex.ru 2008-10-10 09:04 ------- *** Bug 2412 has been marked as a duplicate of this bug. *** -- |
February 18, 2009 [Issue 2095] covariance w/o typechecks = bugs | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2095 maxmo@pochta.ru changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lat7h@virginia.edu ------- Comment #2 from maxmo@pochta.ru 2009-02-18 04:40 ------- *** Bug 2544 has been marked as a duplicate of this bug. *** -- |
February 18, 2009 [Issue 2095] covariance w/o typechecks = bugs | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2095 maxmo@pochta.ru changed: What |Removed |Added ---------------------------------------------------------------------------- OtherBugsDependingO| |2573 nThis| | ------- Comment #3 from maxmo@pochta.ru 2009-02-18 04:43 ------- solution was proposed in bug 2412 comment 3 -- |
February 18, 2009 [Issue 2095] covariance w/o typechecks = bugs | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2095 smjg@iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com ------- Comment #4 from smjg@iname.com 2009-02-18 04:53 ------- This and bug 2412 are about covariance of classes. Bug 2544 describes covariance of array constancy, which is basically the same but we need to remember that the solution needs applying to both. See also http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=81566 -- |
February 18, 2009 [Issue 2095] covariance w/o typechecks = bugs | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2095 ------- Comment #5 from maxmo@pochta.ru 2009-02-18 05:28 ------- As I remember, it was pointed out that rules for implicit conversions of arrays are formulated uniformly for complex and primitive types, and this report is exactly about those rules, and solution for classes works for primitive types. -- |
February 19, 2009 [Issue 2095] covariance w/o typechecks = bugs | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2095 jason.james.house@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason.james.house@gmail.com ------- Comment #6 from jason.james.house@gmail.com 2009-02-18 22:06 ------- I don't know if it's wise to mark bug 2544 as a duplicate of this bug. For example, the proposed solution (comment 3) shows a lack of understanding of this related issue. Specifically, I believe the proposed solution in bug 2412 comment 3 says the following would be ok: class base{} class derived:base{} derived[] x = new derived[2]; const(base)[] safe = x; That really isn't true. Take the following code that should resize the arrays in place: derived[] x = new derived[2]; derived.length = 1; const(base)[] safe = x; x ~= new derived(); // x[1] is now valid derived instance safe ~= new base(); // just overwrote x[1] with a non-derived instance -- |
February 19, 2009 [Issue 2095] covariance w/o typechecks = bugs | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2095 ------- Comment #7 from maxmo@pochta.ru 2009-02-19 03:01 ------- isn't this bug 2093? -- |
February 19, 2009 [Issue 2095] covariance w/o typechecks = bugs | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2095 ------- Comment #8 from maxmo@pochta.ru 2009-02-19 03:09 ------- int[] x=[1,2]; x.length=1; int[] y=x; x~=3; // x=[1,3] y~=4; // x=[1,4] bug 2093 has little to do with covariance. Added as dependency. -- |
February 24, 2009 [Issue 2095] covariance w/o typechecks = bugs | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2095 ------- Comment #9 from maxmo@pochta.ru 2009-02-24 03:24 ------- This turned out to be well-known. Bug 926. In NG: http://www.digitalmars.com/d/archives/17039.html -- |
Copyright © 1999-2021 by the D Language Foundation