Giter Club home page Giter Club logo

echoes's People

Contributors

deepcake avatar player-03 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

Watchers

 avatar  avatar  avatar

echoes's Issues

Haxe compiler server issues with macros

Do you use vscode with the Haxe compilation server mode? I had a lot of ramp up issues when using Echoes because macro issues would often get the server into a permanent broken state.

Now I trained myself to restart the Haxe compilation server whenever I see huge cryptic compiler errors :)

Just wanted to point this out in case anyone searches for the this. It's probably an issue in Haxe, but hard to repro. But maybe there are things this repo could do to avoid falling into those issues.

Sorry that I don't have a repro case right now.

Compile error when `echoes_profiling` is set

When I compile a project and set the echoes_profiling flag, it gives a build error in
System.hx:193: characters 38-52 : Float should be Int

From the code:

public function getStatistics():SystemDetails {
		return {
			name: Std.string(this)
			#if echoes_profiling , deltaTime: __updateTime__ #end
		};
}

It looks like __updateTime__ is a Float while deltaTime is an Int

Why this vs deepcake/echo?

This framework was designed and implemented by deepcake, and is now maintained by player-03.

This sentence makes me think that https://github.com/deepcake/echo is no longer maintained. Is this really true? Can we add more context? What is the story behind this repo? Why did you create this separate repo? Would be curious to know :)

EDIT: maybe we can add a note to deepcake/echo pointing here if it's really true that it is now maintained here.

Unsafe to call `entity.add()` during `@removed` listener

Bear with me; this is complicated.

Due to the order of these two lines, @removed listeners will be called before the component is actually removed. It's pretty easy to see this in action:

@removed private function onFooRemoved(foo:Foo, entity:Entity):Void {
    trace(foo == entity.get(Foo)); //true
}

At first this seems weird but harmless. However, problems arise if you try to replace one component with another.

@removed private function onFooRemoved(foo:Foo, entity:Entity):Void {
    entity.add(new Bar());
}

@added private function onFooBar(foo:Foo, bar:Bar):Void {
    throw "Entity should not have both Foo and Bar components!";
}

This occurs because during onFooRemoved, the Foo component is still there. If you add Bar, then the entity will be added to ViewOfFooBar, triggering onFooBar.

But it gets worse:

@removed private function onFooRemoved(foo:Foo, entity:Entity):Void {
    entity.add(new Foo());
}

@update private function updateFoo(foo:Foo):Void {
    trace(foo); //null
}

Due to the order of events, Foo is removed after the add(new Foo()) line, meaning the entity remains in ViewOfFoo even though the component is gone. Then the view will continue calling updateFoo().


Lots of problems caused by that particular ordering of lines. So why don't we just swap them?

The reason is that in order to dispatch @removed events at all, the entity's components must still exist. One final lookup is performed to find all the arguments to pass.


Possible solutions:

  • Cache the value being removed, fully remove it from the entity, and then dispatch the @removed event using the cached value to fill in the blank. Problem is, dispatchRemovedCallback() would have to be massively rewritten. I'm not sure such a rewrite is even viable, and if it was, I doubt it'd be efficient.
  • Postpone the entity.add() call until after remove() is fully resolved. Use an event queue or something. Problem is, when you call add() you expect to be able to call get() right after.

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.