plietar has quit [Remote host closed the connection]
_whitelogger has joined #ponylang
Xe has quit [Ping timeout: 248 seconds]
Xe has joined #ponylang
_andre has joined #ponylang
_andre has quit [Ping timeout: 264 seconds]
_andre has joined #ponylang
jemc has joined #ponylang
endformationage has joined #ponylang
vaninwagen has quit [Ping timeout: 276 seconds]
Matthias247 has joined #ponylang
samuell has quit [Remote host closed the connection]
Matthias247 has quit [Read error: Connection reset by peer]
DaveMan has joined #ponylang
plietar has joined #ponylang
Praetonus has joined #ponylang
plietar_ has joined #ponylang
plietar has quit [Ping timeout: 276 seconds]
DaveMan has quit [Ping timeout: 260 seconds]
vaninwagen has joined #ponylang
plietar has joined #ponylang
plietar_ has quit [Remote host closed the connection]
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
Matthias247 has joined #ponylang
plietar has quit [Ping timeout: 248 seconds]
samuell has joined #ponylang
samuell has quit [Quit: Leaving]
jemc has quit [Ping timeout: 255 seconds]
vaninwagen has quit [Ping timeout: 248 seconds]
DARKAV has joined #ponylang
<endformationage>
Here's an FFI related question:
<endformationage>
I have a C function which takes a `void* data`, where data is really an array on U8 or floats.
<endformationage>
Passing a Pony Array[U8] is easily done, by calling the array's `cpointer()`, and assigning the type `Pointer[U8] tag` to the FFI functions parameter.
<endformationage>
Of course, calling `cpointer()` on an Array[F32] results in a `Pointer[F32] tag`, which will not be acceptable to the use declaration of the FFI function.
<Praetonus>
endformationage: You can use a `Pointer[None]`. It's a generic pointer similar to void* when used as an FFI parameter type
<endformationage>
The C side of things is able to determine whether data should be interpreted as unsigned char or float, via other params to the function.
<endformationage>
Ah, awesome. Thanks Praetonus!
Matthias247 has quit [Read error: Connection reset by peer]
<endformationage>
If I want to have ageneric type parameter that accepts only 2 types, to I just define it as a union type? i.e. [T: (Foo | Bar)]
<endformationage>
Hmm, am I correct to say constructors cannot be generic with the class being so?
<endformationage>
As in, it doesn't make sense to make a constructor a generic method.
<Praetonus>
endformationage: Yes to the union type as a type parameter constraint
<endformationage>
* I meant to ask: Am I correct to say constructors cannot be generic WITHOUT the class being so?
<endformationage>
I've made a constructor in the form of a generic method, and I'm attempting to assign a generically typed datum to a field of the class, which is not generically typed (though is typed the same as the constraints would allow).
<endformationage>
I think I need to make the class generic.
<Praetonus>
endformationage: Constructors can be generic even when the associated type isn't. Do you have some code to illustrate your problem?
<endformationage>
Perhaps the issue is with my dealing with the union type field and param
* endformationage
will be back in a bit, thanks!
<Praetonus>
endformationage: So the issue here is that an `(X | Y)` constraint also accepts the `(X | Y)` type itself. Which means that the type argument could be `Array[(U8 | F32)]`, and the type checker is catching that
<Praetonus>
You need to specify that your type parameter can only be a concrete type, but I'm not sure how to do that
<endformationage>
Ah, hmm, OK.
<Praetonus>
You could try posting a message on the mailing list, maybe somebody has a solution