Haxe (Flash) and inlay

My question is about embedding in Haxe (AS3) in several situations.

  • Will any method marked with the inline (static and non-static) always be implemented, always at compile time?
  • Are the default properties? If not, is there a way to overlay them? (Perhaps by assigning them built-in access methods)
  • If inline methods disappear at compile time, is it possible to get functors from them?
+4
source share
1 answer

Have you seen the embedded document on haxe.org?

1. there (in the dock) there are some restrictions on the imposition of functions. In addition, you cannot inline a recursive function. I believe that all methods marked as inline will be nested (the reason is if there is no --no-inline oprtion in your hxml file), if any method with the inline marker cannot be built in, an error will be selected during compilation.

2. No, they do not. You can only embed static vars, otherwise you will get a compilation error ( Inline variable must be static ). Note that inlined var obviously cannot be changed, so there is no reason to include a non-static var. If you are inline geter or seter :

 private var v: Bool; public inline function getv(nv: Bool) { return v; } 

It will be considered as:

 private var v: Bool; public inline function getv(nv: Bool) { return this.v; } 

after insertion this will be changed with reference to the class. Take a look at an example . None of the properties of the StopWatched class are there.

  • I'm not sure I understand what a functor is.
+4
source

Source: https://habr.com/ru/post/1401514/


All Articles