plasma-umass / doppio

Breaks the browser language barrier (includes a plugin-free JVM).
http://plasma-umass.github.io/doppio-demo
MIT License
2.17k stars 176 forks source link

Reduce surface area #260

Closed perimosocordiae closed 11 years ago

perimosocordiae commented 11 years ago

In the spirit of trying to modularize Doppio, I've come up with a list of points that we currently reach into the core library:

The items under jvm are ones that we can roll into a (hopefully) upcoming JVM object. This can manage the classpath, the bootstrap classloader, and the creation/management of the runtime state.

perimosocordiae commented 11 years ago

The public interface for Doppio now looks like:

import disassembler = require('./disassembler');
import jvm = require('./jvm');
import logging = require('./logging');

// Function that takes a classfile buffer and emits disassembly as a string.
export var disassemble = disassembler.disassemble;

// Class that encapsulates the entire JVM.
export var JVM = jvm.JVM;

// Set of values for controlling how much logging is emitted.
export var log = {
  level: logging.log_level,
  VTRACE: logging.VTRACE,
  TRACE: logging.TRACE,
  DEBUG: logging.DEBUG,
  ERROR: logging.ERROR
};

I'm not sure what the best way to expose this is. Perhaps make a main.ts file with these contents and use that to generate the full doppio.js library? Or just craft a doppio.d.ts with this information?

Our console and browser frontends actually use slightly more than what I've listed above, but those cases are either temporary hack-arounds or development-specific (i.e., testing) code.

jvilk commented 11 years ago

The following would probably be best:

It would result in us duplicating the type annotations across the two files, but maybe that's a Good Thing; it forces us to know when we make breaking API changes.