Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Peter Achberger
@Antriel
Ben
@benmerckx
To be more specific, I don't have the type available. I'd like to have a function merge<A: {}, B: {}, C: B & A>(a: A, b: B): C {...}to return an anonymous type instead of a constrained monomorph somehow. Or, if that is impossible have a way to definitively close monomorph C before using it.
Peter Achberger
@Antriel
Hm, isn't the result already closed?
Kevin Leung
@kevinresol
is that related :point_up: ?
Peter Achberger
@Antriel
Interesting.
Ben
@benmerckx
Yeah, since that was fixed it is possible to express it in the type system. However, monomorphs do not seem the easiest to work with afterwards since: IDE support is not perfect (hovering shows a question mark instead of the type) and it is useless to macro code (can't do much with a TMono in tink.Anon for example).
Kevin Leung
@kevinresol
oh well, yeaaaaaaaaah,
but looks like you got a solution?
Ben
@benmerckx
A hacky one, was wondering if there's a proper way :)
serjek
@serjek
haxe.macro.Position has no field file - why is that?
ah need to use getInfos(). nvm then
ShalokShalom
@ShalokShalom
Hi there. I just spend 15 minutes, searching for @pure in the documentation, and the build-in search has shown me nothing and I think this could be improved. Also consider adding this to the documentation about functions itself.
Here is it, currently pretty hidden for the value it provides, imho: https://haxe.org/manual/cr-metadata.html
And this is one of the many places, I find it appropriate to be added: https://code.haxe.org/category/beginner/declare-functions.html
Ciau
Axel Huizinga
@axelhuizinga
which settings enable me to see a call to an @:autoBuild function? where is the output of trace printed there
Axel Huizinga
@axelhuizinga
how can I get rid of this error message?
WARNING in ./build.hxml
Module Warning (from ./node_modules/haxe-loader/index.js):
/opt/src/DevTest/client/.haxelib/js-object/0,0,7/src/js/Object.hx:160: characters 18-20 : Warning : Using "is" as an identifier is deprecated
Error: /opt/src/DevTest/client/.haxelib/js-object/0,0,7/src/js/Object.hx:160: characters 18-20 : Warning : Using "is" as an identifier is deprecated
at /opt/src/DevTest/client/node_modules/haxe-loader/index.js:58:29
Kevin Leung
@kevinresol
-D no-deprecation-warnings
Ties Baltissen
@Skudoku
Is there a byte datatype in Haxe? I know of Bytes. and when you use Bytes.get(index) it returns an int, can I assume in that way that Haxe uses just Int for a single byte?
Jonas Sonn Jørgensen
@JonasSonn
Hi @ShalokShalom,
Woops, continued: do you know the purpose of @pure? I'm trying to find out what it means when you say a function is side effect free
Short answer... uh..
A function that do not modify anything when called, nor interact with the outside.

Pure functions closely resemble mathematical functions: they do nothing other than compute an output value based on their input values.

Not bad x)

pecheny
@pecheny
@Skudoku Haxe is multitarget language so common types should be available on the all platforms. So it depends on platform(s) you are targeting. For example if you are targeting js – there is no byte type here, only Number. It can't be helped in haxe. For targets with byte type like cpp, cs and java you can look for Int8 in the appropriate package i.e. cs.Int8 for c#.
Ties Baltissen
@Skudoku
Ahh gotcha, so for anything that I will be using byte for I should look for target specific usages that might need to handle that datatype
pecheny
@pecheny
If you don't mind memory usage you can use just Int. It would be like 32 bit but available to read/write with Bytes.
I may be wrong but i think so.
Ties Baltissen
@Skudoku
Hmm alrighty, another question. I have found some info on generics and interfaces and such, but I have a specific case which I am not sure about how to deal with that.
public interface SomethingPipe<T> where T : Something how does one go about making this in Haxe.
Peter Achberger
@Antriel
interface SomethingPipe<T:Something>
Ties Baltissen
@Skudoku
Ah thanks!
Couldnt come up with the term that is type parameter
serjek
@serjek
hey guys did anyone already implement externs for react-native-iap or something alike to handle in app purchases in haxe react? I looked through haxe-react group but found only externs for some outdated libs that were last updated 6-7 years ago. so I wonder, perhaps you have something but forgot to share it?
Juraj Kirchheim
@back2dos
these days dts2hx does a pretty fine job ;)
serjek
@serjek
ah well, saved this for last resort
Jonas Sonn Jørgensen
@JonasSonn
Hi! I'm quite new to haxe, I can't figure out how to set an enum as a method parameter type. My enum: 'SomeEnum<A,B,C>' I thought I could do: 'function methodName(i: SomeEnum)' then I tried: 'function methodName(i:SomeEnum<A,B,C>)'. In https://haxe.org/manual/types-enum-using.html they write 'getColor():Color' where the enum Color is a return type.
postite
@postite
is that what you try to do ? https://try.haxe.org/#356D1e26
Jonas Sonn Jørgensen
@JonasSonn
Almost! This is more exact https://try.haxe.org/#70D60211
postite
@postite
ok . so what is your problem now ?
Jonas Sonn Jørgensen
@JonasSonn
I get the error message: Not enough type parameters for MyEnum
postite
@postite
what are X, Y and Z ?
Rudy Ges
@kLabz
Try with static function met<X, Y, Z>(m:MyEnum<X, Y, Z>) { ... } (and fix met(A) which is not a valid value for your enum)
I'm also interested in your proper use case, as the example isn't making much sense (or doesn't provide any type safety at least)
Jonas Sonn Jørgensen
@JonasSonn
Thanks for the snip, it works. About the use case: I have a member variable that in the constructor is set to be some type. Later a method is invoked that run a switch casing on the type of enum, e.g.(X,Y or Z) and returning an enumvalue of some type. Next we call a method with this enumvalue as a parameter. But you're right, the type safety is getting weaker and I think I will constrain it using abtract types as they do here https://code.haxe.org/category/other/passing-different-types-to-a-function-parameter.html (near the end of the page).
Ties Baltissen
@Skudoku
So I have this Haxe project, a few folders with lots of classes and all. What do I need to do to compile the whole project to another language? Instead of having to call each individual file to do so?
Jonas Sonn Jørgensen
@JonasSonn
If I understand your question correctly I believe you just have to target your main module with: haxe --main Main --interp, you can add many more arguments(see https://haxe.org/manual/compiler-usage.html). It might be easier if you use hxml files https://haxe.org/manual/compiler-usage-hxml.html else take a look at the Hello World example https://haxe.org/manual/introduction-hello-world.html
Ties Baltissen
@Skudoku
Ah alright, I did folow that hello world example, I just need to setup a hxml file, since I have quite some files and need to figure out what my main module is