Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8016220

An option for writable prototype would greatly help making existing scripts to run on top of nashorn

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 9
    • core-libs
    • None

      The pattern A extends B is commonly (would say 70% of usage) implemented in the following way:
      A.prototype.__proto__ = B.prototype;

      As we know, in nashorn this has no effect.

      We are rewriting it as (using node 'util' module) : require("util").inherits(A, B);
      We are also restructuring some code to only create instance after the prototype has been fully defined.

      This imply a lot of patching.

      Having an option to enable writable proto would help run existing scripts unmodified.

            jlaskey Jim Laskey
            jfdenise Jean-Francois Denise (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: