Skip to content

Add eval socket compatibility shim for haxe 4.2+#3

Open
dimensionscape wants to merge 1 commit into
BowlerHatLLC:mainfrom
dimensionscape:fix/eval-luv-server
Open

Add eval socket compatibility shim for haxe 4.2+#3
dimensionscape wants to merge 1 commit into
BowlerHatLLC:mainfrom
dimensionscape:fix/eval-luv-server

Conversation

@dimensionscape

Copy link
Copy Markdown

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.

@joshtynjala

Copy link
Copy Markdown
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;
#end

If 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants