Skip to content
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

Neko soft deprecate : split off conditional compilation into separate impl #9350

Merged
merged 5 commits into from
Apr 27, 2020

Conversation

jdonaldson
Copy link
Member

Here's a "soft deprecate" effort for neko code in std lib.

Neko shows up in a lot of std lib files as a conditional (#if neko). However, neko isn't being actively developed at present, so the extra markup dedicated to it can be construed as clutter.

This PR identifies places in the std lib where neko is specified (uniquely) as a conditional on a base std implementation, and splits the neko-specific code into a neko-specific implementation.

This is primarily an aesthetic change, so I'm including a number of old and new people on the review to weigh in.

@Gama11
Copy link
Member

Gama11 commented Apr 25, 2020

This seems to look good in all cases except JsonPrinter, where it creates quite a bit of code duplication?

@back2dos
Copy link
Member

Well, I'm not sure what this solves, but why not.

As for the code duplication, perhaps string quoting could be extracted to a separate class?

package haxe.format;

class JsonHelper {
  static public function quoteString(string:String, out:Buf):Void;
}

Then that could be overridden by platform. Added bonus: by handing string serialization off to the native encoders, it could be used to speed up serialization on Python in general, and on JS and PHP for -D haxeJSON.

@RealyUniqueName RealyUniqueName added this to the Release 4.1 milestone Apr 25, 2020
@jdonaldson
Copy link
Member Author

This seems to look good in all cases except JsonPrinter, where it creates quite a bit of code duplication?

I agree, I might take @back2dos 's recommendation there and just split off a helper method.

@ncannasse
Copy link
Member

I think we should leave JsonPrinter as it ;)

@jdonaldson
Copy link
Member Author

Yeah I’m leaning that way now too. I’ll leave it alone for now.

@jdonaldson jdonaldson merged commit b40d5ce into development Apr 27, 2020
@jdonaldson
Copy link
Member Author

I'll drop JsonPrinter since it causes some duplicate code issues, and resolving those complicates the intent of this PR too much.

@ncannasse
Copy link
Member

There's a bug because you have removed code from haxe.Timer that applied to both neko and php targets, without replacements.

@kLabz
Copy link
Contributor

kLabz commented Apr 28, 2020

Shouldn't it be handled by the #elseif sys, like it was said in the comment there?
https://github.com/HaxeFoundation/haxe/pull/9350/files/689c5ad9cc46113ad88f75b81b029eb34c62ad9f#diff-b44b9c0a3881444b2b842cf68d00ed3c

@jdonaldson
Copy link
Member Author

Yeah, the default sys case should handle those two.

@jdonaldson jdonaldson deleted the neko_soft_deprecate branch April 30, 2020 16:48
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.

7 participants