-
-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
php: ability to declare extern methods in root namespace #4876
Comments
I don't know that Haxe has a plan to support @:native(""). The Haxe Magic - Php Magic |
So long as performance doesn't become an issue, you @:native the class to Otherwise I suggest writing a macro. On Thu, Mar 3, 2016 at 5:36 AM, musou1500 notifications@github.com wrote:
|
Now I use I trying wrote a macro. The first problem - if macro function in class inside So, only a really good way - support real externals for root functions. With working |
For example, now extern for public static function get_html_translation_table(?table:Int, ?flags:Int, encoding="UTF-8") : NativeArray
{
if (untyped __physeq__(flags, null))
{
if (untyped __physeq__(table, null))
{
return untyped __call__('get_html_translation_table');
}
else
{
return untyped __call__('get_html_translation_table', table);
}
}
else
{
return untyped __call__('get_html_translation_table', table, flags, encoding);
}
} |
I wrote a couple of PHP externs recently and I agree that this is problem. A missing argument is always passed as But the function above is a bad example, because all its arguments have default values actually. I would write an extern for it like this:
Inlining this helps a lot and generates relatively concise PHP code. It also has the nice effect, that you can pass Also using |
Thank you, @mockey, you right: haxe's |
@yar3333: Yeah right, looking up constant values is not so nice. You can define an |
I'm not sure if this was closed by the linked PR or not... |
Generally it should be closed by the PR, not sure if @yar3333 has tried it or if he wanted something else.... But as I wrote here: #5006 |
I'll consider it close then, the |
I try to create externs for standard functions:
Result php code:
If this is not too complex, I ask to support @:native("") on php target.
The text was updated successfully, but these errors were encountered: