GithubHelp home page GithubHelp logo

jeremyfa / interpret Goto Github PK

View Code? Open in Web Editor NEW
67.0 67.0 11.0 1.41 MB

Turn haxe classes into scriptable/interpretable/hot-reloadable code using hscript

License: MIT License

Haxe 99.91% Shell 0.09%

interpret's Introduction

interpret's People

Contributors

jeremyfa avatar klabz avatar lythom avatar tpr-evilempire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

interpret's Issues

call static function within self class errror.

add a static function in WatchedClass.hx after build hxml

@interpret  public static function hello():Void{
                trace("static function11");
    }

when call

WatchedClass.hello();//error.

 @interpret  public static function hello():Void{
                trace("static function11");
    }

    /** This is an interpretable method. It is compiled as native haxe code with the app,
        but if the method is updated while the app is running, its new content will be live-reloaded
        and the code will be executed with `interpret`. */
    @interpret public function printSomething() {

        // Just testing calling a native (non-interpreted) method
        // and get its return value
        var className = getClassNameFromNative();

        // Then printing something (note that string interpolation works :))
        trace('$className');
        hello();//work.
         WatchedClass.hello();//error.
       trace(NativeClass.randomName());//error
       

    } //printSomething

hscript code block overrided by native one ?

Hello there,
being satisfied with my test on hashlink platform with that excellent lib, I gave it a try over our production project. (which is a game).

I manage to make soemthing apparently working. At first, I didn't catch the #if interpretABLE token and used #interpret , and on haxe 4 version I had to come up with some hacks to make the __interpretWatch static actually being called. (var watch = __interpretWatch; does the trick).
https://try.haxe.org/#fc965

So now I have the file changes detected, and getting some wierd result/behaviour. And I hope you can help me finding whats is happening here .

Here the code I'm "interpreting" on my game entity :

override function postUpdate() {
	super.postUpdate();
	behave();
}
@interpret function behave() {
	trace("Behave");
}

Let say, the game run and prints "Behave" every frame correctly.
If I'm changing that text to something like "Behave from interpreter" like so :

@interpret function behave() {
	trace("Behave from interpreter");
}

I'll get in game output (which is a trace redirection) :

my.entity.Boss(lineNumber): Behave
interpret/macros/InterpretableMacro.hx:322: File changed at path myEntityFilePath.hx
hscript:9: Behave from interpreter
my.entity.Boss(lineNumber): Behave
my.entity.Boss(lineNumber): Behave
my.entity.Boss(lineNumber): Behave
my.entity.Boss(lineNumber): Behave
...

everytime I make a change, I'm getting the desired print change, but not the frames after that, that will be the native text ..

Any idea on what is happening here?
(I do have other question after that one, which might be related, so let see if solving this one resolves the other first :) )

It doesn't seem to work with HL

Interpret macro is failing to load Std type when using HL target.

That should probably not be too hard to fix, but needs to be tested.

[cs]DynamicModule.hx(840,97) is inaccessible due to its protection level

`env.addModule("unityengine.Camera", DynamicModule.fromStatic(unityengine.Camera));`

hello,I'm try this with unityengine. and got this error.

error CS0122: 'Camera.ProjectionMatrixMode' is inaccessible due to its protection level

and cs code

` internal extern Camera.ProjectionMatrixMode projectionMatrixMode { [MethodImpl(MethodImplOptions.InternalCall)] get; }

image

`

[Bug] Macro Fails on Modules w/ Private Classes

When using DynamicModule.fromStatic() on a module that contains a private class, the error Class<class.goes.Here> has no field private.class.Here.

A real trace:

C:\HaxeToolkit\haxe\std/haxe/macro/MacroStringTools.hx:70: characters 84-89 : Class<flixel.input.mouse.FlxMouseEventManager> has no field ObjectMouseData
source/fnf/psyche/api/EnvPopulator.hx:247: characters 60-125 : ... Called from macro here

The accompanying code is:

env.addModule("flixel.input.mouse.FlxMouseEventManager", DynamicModule.fromStatic(flixel.input.mouse.FlxMouseEventManager));

You can find the private class here: https://github.com/HaxeFlixel/flixel/blob/27960e3b66c8ebad0052973831960761971168fd/flixel/input/mouse/FlxMouseEventManager.hx#L720

Unsure if this is a limitation or just a general bug, not too well-versed with macros. For now, I can fix this by just omitting modules containing private classes, but this is a band-aid fix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.