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

[Clojure] forced inheritance from Application class an issue

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: fx2.0
    • Fix Version/s: fx2.0
    • Component/s: javafx
    • Environment:

      Any OS running clojure or other very dynamic language.

      Description


      javafx.application.Launcher/launch requires that a class be passed.

      From clojure's point of view (I'm working on some bindings) this is
      a bad thing. It requires ahead of time (AOT) compilation using clojure's
      gen-class facility. AOT is avoided at all costs in clojure because the
      language is still rapidly evolving and using it in libraries tends to create
      breaking binary incompatibilities, and because it is unidiomatic
      and generally painful to do so at the user level.

      Much better would be requiring an instance of an interface, something like
      ApplicationActions or ApplicationDelegate providing the start, stop, delete and init
      methods. It could be passed to the Launcher and delegated to by the Application
      object which would be created behind the scenes. Providing an interface would
      allow for use of clojure's new datatype/reify facilities which can be derived from java
      interfaces.

      Second best, but better than the present situation would be to have a delegate
      class and to require the pasing of an instance of a subclass of that class rather
      than of Application itself.

      Another cool idea which would play well with clojure's functons (which implement
      runnable & callable), would be to add an overloaded launch method which takes
      a single callable, and builds an ApplicationDelegate whose start method calls the
      callable. As I understand it this would also work well with JSR 335's lambdas, and
      would be great for quickly whipping up quick tests apps in any JVM language.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kcr Kevin Rushforth
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: