What is the right way to "override" some std classes?

Hej,

I work a lot with nightly builds like a kamikaze, and I do some changes to some std classes. And when I upgrade the nightly builds version of haxe, I always have to “override” some std classes.
I’ve seen that : Is there any way to prefer local classes instead of library classes with same package?

Is it the best way to do that plase ?

Well, it’s hard to say if there’s a better way without knowing what changes you are making.

The term for what’s described in that other thread is “shadowing” and it can be quite powerful. But generally, I think you should try to avoid doing that as much as possible as it makes things harder to maintain.

I’ve just “updated” haxe/http/HttpJS.hx like on this discussion, I even don’t know if it will be taken in account or not but anyway, I use it, I know it’s not recommanded, I try to becareful, but until there is nothing “better”, I work with my “upgrade” :

And how to do if my file is in a lib ? Nothing to do with _std folder something like that ?
Because specify a relative path would be painful if the lib is not in the same structure folder …

Ok I found, just put my file into the same folder structure that std, all inside my lib. It’s ok thnaks :wink:

Also, you can patch any class with a build macro added via --macro addMetadata('@:build(path.to.Macro.build())', 'haxe.HttpJs')

1 Like

The right way is to bend it like Neo!

2 Likes