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
--native-lib #7450
Comments
Let's make |
What does |
… On Sat, Sep 22, 2018 at 7:33 AM Juraj Kirchheim ***@***.***> wrote:
What does haxe.macro.Compiler.addNativeLib do right now though? ^^
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7450 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-bwLiZpx21h7zjMFiYKUCYrn2Pemrvks5udcuWgaJpZM4WzsyP>
.
|
I think we have to do something here for 4.0. I'm not just talking about Related issues: #7417 and #7651 Our native library handling was never updated to support the compilation server properly. On every request, which includes display requests, the functionality kicks in and does something. The way it currently works is this:
It's important to note that step 2 is lazy: The native representation is not converted to a Haxe module unless explicitly requested via dot-path. The problem is that we perform step 1 on every request. Even worse, C# actually goes on a hunt in the file system to find its net-std file, which is part of the problem in #7651. I propose the following approach when the compilation server is running:
This would greatly simplify the handling on the compilation server because native libraries become a one-time read-and-forget thing. It will automatically fix related display issues like #7417 because we deal with the syntax representation as if we had normal Haxe modules. We can still keep Any thoughts? |
What if the eager loading finds some types in a library that cause an error? With lazy loading you can simply avoid importing/using these types. |
Technically, that shouldn't happen in the first place. But putting a catch-all around this might be a good idea regardless. |
My approach doesn't work because the parser-cache is file-based. This would require a separate caching mechanism, which makes matters much more complicated. |
We don't really need eager evaluation, just keeping the modules in memory
and linking them to the native library as a dependency should make sure
they are kept in cache and only discarded if native library changes. This
would still reparse the library in case a _new_ module gets loaded from it,
but we can also have a cache for the step 1
…On Mon, Aug 12, 2019 at 4:02 PM Simon Krajewski ***@***.***> wrote:
My approach doesn't work because the parser-cache is file-based. This
would require a separate caching mechanism, which makes matters much more
complicated.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7450?email_source=notifications&email_token=AAHZXQCXVFNKT2OWIXBIETLQEFUN5A5CNFSM4FWOZSH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4CT6ZA#issuecomment-520437604>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHZXQDSQUADF35U3P5QXRLQEFUN5ANCNFSM4FWOZSHQ>
.
|
I'm not quite sure what you're saying we should cache. There are 4 stages when it comes to processing a native library:
I'm proposing to cache 3. because that's what the display handling needs and I doubt there's much of a size difference between 2. and 3. |
Regarding the actual new CLI argument, there's the need to configure some things per-library (e.g. a flag to ignore unknown types in #3397, or whether to include a native library in the output). How about we allow JSON input for this new flag? It would be |
* [cli] add --native-lib and --native-lib-extern closes #3469 see #7450 closes #8080 * two-pass native library handling * don't write to stderr because that fucks up the comp server * handle extern libs differently Both Java and C# need access to all libs in java_libs/net_libs in order to implement their `lookup` functions. * hold back on --native-lib CLI argument for now
Having to type json in CLI args makes me sad. |
How would that work in practice given that the setting is per-library? |
What's the relationship between the compiler arg and If that's not an option, I would suggest that the On a side note: I wonder why we're using JSON for everything lately. For some of this config stuff, I think haxe expressions might be a better fit. Not only are they nicer to write (less quotes, allow comments, trailing commas, could even contain enums where it makes sense), we also have a position tracking parser for them. And I suspect the typer could be leveraged to guarantee validity (would probably need a separate context to not cause mayhem - perhaps there's a way to eagerly populate it with types and then disable further type loading it it?) and give things like |
I like the idea to allow |
While we're changing the commandline implementation, I think we should review our definition of "native library".
ATM we have:
haxelib path
can return-L
for native neko libs. There's no other way to inject them-swf-lib
, C# has-net-lib
, Java has-java-lib
I propose regrouping all of the there under a single
--native-lib
(with aliases to older-swf-lib
etc.), and have a singlecom.native_libs
.The text was updated successfully, but these errors were encountered: