Add eval socket compatibility shim for haxe 4.2+#3
Open
dimensionscape wants to merge 1 commit into
Open
Conversation
Member
|
Thanks! Ideally, I'd like to do something like this: #if (eval && (haxe_ver >= 4.2))
import snake._internal.net.Socket;
#else
import sys.net.Socket;
#endIf both classes have the same public API, nothing else in the existing code should need to change except which class gets imported. It should be fairly easy for me to modify the code from your PR to do that. I might not have a chance to dig into it right away, though, so feel free, if you feel like scratching that itch. I'll probably find a moment later this month, though. |
819a8d1 to
a67c394
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an eval socket shim using eval.luv, while keeping the existing sys.net.Socket path for other targets and older Haxe versions.
Also adds a small socket compatibility test and a test for for the issue highlighted in HaxeFoundation/haxe#12958
You may want to shadow sys.net.Socket entirely but I thought this was perhaps a little bit cleaner. EIther way, it's a public API decision.