Giter Club home page Giter Club logo

moon-core's People

Contributors

profound7 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

moon-core's Issues

nested functions in coroutines referencing a variable from coroutine

Since variable names within coroutines are renamed to unique names and are hoisted to the top, functions defined within coroutines that uses those closure variables will get variable not found error.

This should be easily fixed in pass_var by going through functions as well.

Compilation problems on async example

I tried to use moon-core straight out of the box to convert a function of mine to async, so that it could show a loading indicator while loading. I got some compiler errors.

So I tried to just compile the sugared async example, and got the same errors. Maybe my haxe 3.2.1 for win7x64 is the wrong environment? Or am I missing something else?

Here's trying to compile the example from the command line:

C:\HaxeToolkit\haxe\lib\moon-core\1,0,0\test>haxe -lib moon-core -main AsyncSuga
redExamples AsyncSugaredExamples.hx
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:20
: characters 22-42 : Class<haxe.macro.Context> has no field getLocalType
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:58
: characters 22-40 : Class<haxe.macro.Context> has no field currentPos
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:60
: characters 25-47 : Class<haxe.macro.Context> has no field getBuildFields
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:12
5: characters 12-30 : Class<haxe.macro.Context> has no field defineType
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:20
: characters 22-42 : Class<haxe.macro.Context> has no field getLocalType
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncMacroTools.hx
:121: characters 27-41 : Class<haxe.macro.Context> has no field typeof
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:70: characters 29-52 : Class<haxe.macro.Context> has no field getExpectedType
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:79: characters 30-43 : Class<haxe.macro.Context> has no field error
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:90: characters 25-39 : Class<haxe.macro.Context> has no field typeof
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:121: characters 26-39 : Class<haxe.macro.Context> has no field error
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:200: characters 15-37 : Class<haxe.macro.Context> has no field getLocalModule
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:648: characters 34-47 : Class<haxe.macro.Context> has no field error
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:654: characters 30-43 : Class<haxe.macro.Context> has no field error
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1173: characters 32-34 : Class<haxe.macro.Context> has no field makeExpr
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1273: characters 48-50 : Class<haxe.macro.Context> has no field makeExpr
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1307: characters 38-40 : Class<haxe.macro.Context> has no field makeExpr
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1313: characters 36-38 : Class<haxe.macro.Context> has no field makeExpr
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1339: characters 43-45 : Class<haxe.macro.Context> has no field makeExpr
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1353: characters 51-53 : Class<haxe.macro.Context> has no field makeExpr

And here's from my project:

C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:20: characters 22-42 : Class<haxe.macro.Context> has no field getLocalType
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:58: characters 22-40 : Class<haxe.macro.Context> has no field currentPos
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:60: characters 25-47 : Class<haxe.macro.Context> has no field getBuildFields
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:125: characters 12-30 : Class<haxe.macro.Context> has no field defineType
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:20: characters 22-42 : Class<haxe.macro.Context> has no field getLocalType
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncMacroTools.hx:121: characters 27-41 : Class<haxe.macro.Context> has no field typeof
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:70: characters 29-52 : Class<haxe.macro.Context> has no field getExpectedType
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:79: characters 30-43 : Class<haxe.macro.Context> has no field error
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:90: characters 25-39 : Class<haxe.macro.Context> has no field typeof
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:121: characters 26-39 : Class<haxe.macro.Context> has no field error
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:200: characters 15-37 : Class<haxe.macro.Context> has no field getLocalModule
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:648: characters 34-47 : Class<haxe.macro.Context> has no field error
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:654: characters 30-43 : Class<haxe.macro.Context> has no field error
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1173: characters 32-34 : Class<haxe.macro.Context> has no field makeExpr
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1273: characters 48-50 : Class<haxe.macro.Context> has no field makeExpr
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1307: characters 38-40 : Class<haxe.macro.Context> has no field makeExpr
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1313: characters 36-38 : Class<haxe.macro.Context> has no field makeExpr
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1339: characters 43-45 : Class<haxe.macro.Context> has no field makeExpr
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1353: characters 51-53 : Class<haxe.macro.Context> has no field makeExpr

(...plus a few others specific to my project)

calling macro functions in coroutines may not work

This is much tougher to solve than the other issues with coroutines.

A macro call looks exactly like a regular function call, except that macro calls receive expressions as their arguments instead of the value of the expressions. Macros can also do whatever with those expressions.

While I can simply don't support yield within the coroutines, due to how variables are renamed, macros may not work. For example, this "short lambda" example where fn is a macro:

function():Iterator<Int>
{
    var y = 0, z = 0;
    fn([x, y] => x + y + z); // undetermined if x, y and z should be mangled or not
}

Variables y and z gets mangled into something like __var_y_0 and __var_z_1. Without knowing what fn does, it's not possible to tell if the generator builder should rename the y and z variables within the fn call.

A possible solution would be to add a meta to indicate "don't do anything to the next expression". Borrowing from Lisp:

function():Iterator<Int>
{
    var y = 0, z = 0;
    @quote fn([x, y] => x + y + @unquote z); // quote preserves everything, z gets mangled
}

Cannot compile for C# target

src/moon/core/Types.cs(13,49): error CS0542: moon.core.Unit.Unit': member names cannot be the same as their enclosing type`

I think the solution is to use enum Unit { UnitValue; } or similar instead.

Private moon-run dependency

Thanks for releasing this! Looks like a tonne of cool stuff in here!

Trying to run the core.hxproj included in this repo on haxe 3.2.1 (is that an OK version of Haxe to use BTW?)

Running process: C:\Program Files (x86)\FlashDevelop\Tools\fdbuild\fdbuild.exe "C:\HaxeToolkit\haxe\lib\moon-core\1,0,0\core.hxproj" -ipc 954b063b-9fb1-4390-8cce-9178b960e864 -version "3.2.1" -compiler "C:\HaxeToolkit\haxe" -notrace -library "C:\Program Files (x86)\FlashDevelop\Library"
Building core
Running Pre-Build Command Line...
cmd: haxelib run moon-run build "Neko"
Library moon-run is not installed
Build halted with errors.
Done(1)

moon-run doesn't seem to be available from haxelib. :)

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.