« Bugzilla Issues Index
#2491 — Changes to default constructor breaks "existing" code
  
  
  - bug_id:
    2491
  
 
  
  
  - creation_ts:
    2014-02-02 12:47:00 -0800
  
 
  
  
  - short_desc:
    Changes to default constructor breaks "existing" code
  
 
  
  
  - delta_ts:
    2015-07-10 08:35:05 -0700
  
 
  
  
  - product:
    Draft for 6th Edition
  
 
  
  
  - component:
    technical issue
  
 
  
  
  - version:
    Rev 21: November 8, 2013 Draft
  
 
  
  
  - rep_platform:
    All
  
 
  
  
  - op_sys:
    All
  
 
  
  
  - bug_status:
    RESOLVED
  
 
  
  
  - resolution:
    FIXED
  
 
  
  
  - priority:
    Normal
  
 
  
  
  - bug_severity:
    enhancement
  
 
  
  
  - everconfirmed:
    true
  
 
  
  
  - reporter:
    Erik Arvidsson
  
 
  
  
  - assigned_to:
    Allen Wirfs-Brock
  
 
  
  
  - cc:
    ["claude.pache", "erik.arvidsson"]
  
 
  
  
  
  
  - commentid:
    7169
  
 
  
  
  - comment_count:
    0
  
 
  
  
  - who:
    Erik Arvidsson
  
 
  
  
  - bug_when:
    2014-02-02 12:47:38 -0800
  
 
  
  
The change to add a return to the default constructor broke some tests we have.
Before
construct(..args) {
  super(...args);
}
Now
construct(..args) {
  return super(...args);
}
The problem arises when we extend an old school "class" where the code does not explicitly set constructor.
function B() {}
B.prototype = { ... }
class C extends B {}
new C() instanceof C  // false
The reason why this fails is that `B.prototype.constructor === Object` so `new C()` returns `Object()`.
The work around is to set `B.prototype.constructor = B` but I feel like the problem, adding return added solved, is smaller than the problem it introduces.
  
  
  - commentid:
    7281
  
 
  
  
  - comment_count:
    1
  
 
  
  
  - who:
    Allen Wirfs-Brock
  
 
  
  
  - bug_when:
    2014-02-12 16:58:15 -0800
  
 
  
  
fixed in rev23 editor's draft
reverted back to the "before" definition
  
  
  - commentid:
    7579
  
 
  
  
  - comment_count:
    2
  
 
  
  
  - who:
    Allen Wirfs-Brock
  
 
  
  
  - bug_when:
    2014-04-06 11:30:56 -0700
  
 
  
  
fixed in rev23 draft