Closed AndreVanDelft closed 8 years ago
I am not happy yet. mouseMove
has now result value Any, instead of java.awt.Point
, or better the MouseMoved
event.
So far, SubScript is untyped. We can of course make ScriptResultHolder covariant by removing var $
(contravatiant position) and describing it through private var _$: R
, def $: R
and def $_(v: Any) {_$ = v.asInstanceOf[R]}
. But this will still register type errors only on runtime - during assignment. So far, these errors are registered in pattern matches in the dataflows - not much difference.
Making SubScript typed implies teaching the compiler to typecheck scripts - to register the errors in compile time. This will require moving the parser and the typer-level preprocessing back to the compiler (perhaps via plugins) and doing major changes to the typecheck system to support SubScript.
So far, it's not a big issue that Swing events are untyped, since this is compensated by the dataflows, like here.
So we can live with it for the time being. The type checking would be easier in the forthcoming Dotty+ScalaParse based version of the SubScript compiler.
Can we then close this issue? Since typecheck for SubScript is a wider issue then this one, it makes sense to make a separate one for it.
Ok.
Current swing scripts have an output parameter, e.g.,
IMO we better replace these by result values:
Then the callers should apply dataflow operators.