<sleeplessy>
how can i check if a var is specified type or not?
Miikka[m] has joined #ponylang
M-hrjet has joined #ponylang
krig[m] has joined #ponylang
irx[m] has joined #ponylang
srenatus has joined #ponylang
dtz has joined #ponylang
lalomartins has joined #ponylang
ehooper[m] has joined #ponylang
nisanharamati has quit [Quit: Connection closed for inactivity]
Praetonus has quit [Quit: Leaving]
gokr has quit [Ping timeout: 248 seconds]
bimawa has quit [Ping timeout: 256 seconds]
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
milisarge has quit [Ping timeout: 248 seconds]
<jemc>
sleeplessy: for type checking at runtime, you want to use `match` or `as`
<jemc>
if you're trying to check at compile time there could be a few different ways depending on what you're doing
patroclos has quit [Ping timeout: 256 seconds]
jemc has quit [Ping timeout: 248 seconds]
TheNet has joined #ponylang
TheNet has quit [Client Quit]
lalomartins has quit [Ping timeout: 256 seconds]
ehooper[m] has quit [Ping timeout: 256 seconds]
irx[m] has quit [Ping timeout: 256 seconds]
Miikka[m] has quit [Ping timeout: 252 seconds]
M-hrjet has quit [Ping timeout: 252 seconds]
dtz has quit [Ping timeout: 255 seconds]
srenatus has quit [Ping timeout: 240 seconds]
krig[m] has quit [Ping timeout: 255 seconds]
jemc has joined #ponylang
milisarge has joined #ponylang
jemc has quit [Ping timeout: 256 seconds]
dougmacdoug has joined #ponylang
<sleeplessy>
jemc : thanx
<sleeplessy>
and..is it possible to call pony from C?
<SeanTAllen>
sleeplessy: yes, for some definition of "call pony" from c. you can send messages to actors that have been exposed.
<SeanTAllen>
sleeplessy: what are you looking to do?
<sleeplessy>
i finished writing a simple logging system and i want provide it to my colleagues
<sleeplessy>
er..provide an api?shall i follow the guidance in pony-tutorial/c-ffi/callback?
<sleeplessy>
C-API actors,alright...
<sleeplessy>
anyway, next time i really should search more then ask
<sleeplessy>
sorry about that
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
jemc has joined #ponylang
dougmacdoug has quit [Quit: dougmacdoug]
milisarge has quit [Ping timeout: 255 seconds]
milisarge has joined #ponylang
<SeanTAllen>
there's a c api to start the runtime, send messages to actors etc. you'll probably want to do a lot of wrapping up of that if others are calling from c.
khan_ has joined #ponylang
khan has quit [Ping timeout: 260 seconds]
khan_ is now known as khan
pparkkin has joined #ponylang
<sleeplessy>
SeanTAllen: alright,i'll check that
khan has quit [Ping timeout: 256 seconds]
jemc has quit [Ping timeout: 240 seconds]
endformationage has quit [Quit: WeeChat 1.9.1]
Miikka[m] has joined #ponylang
krig[m] has joined #ponylang
irx[m] has joined #ponylang
lalomartins has joined #ponylang
ehooper[m] has joined #ponylang
M-hrjet has joined #ponylang
srenatus has joined #ponylang
dtz has joined #ponylang
patroclos has joined #ponylang
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Ping timeout: 260 seconds]
patroclos has quit [Ping timeout: 256 seconds]
puzza007_ has joined #ponylang
khan has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
gokr has joined #ponylang
mwahl has joined #ponylang
pparkkin has quit [Quit: Page closed]
mwahl has quit [Ping timeout: 240 seconds]
codec1 has joined #ponylang
mahmudov has joined #ponylang
puzza007_ has quit [Quit: Connection closed for inactivity]
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
mahmudov has quit [Remote host closed the connection]
khan has joined #ponylang
khan has quit [Ping timeout: 240 seconds]
khan has joined #ponylang
Greg__ has joined #ponylang
<Greg__>
hello ! I'm still reading the tutorial, one page at a time :-) I'm in the interface section and I was wondering if or how I can check if an object is an interface? I though it might be interesting since interfaces in pony are structural subtyping (in other words I don't have to explicitly instruct that a class is an interface)
<Greg__>
I've tried with match but no luck
<SeanTAllen>
greg__: what did you try? can you post a link to a playground with some example code? what are you hoping to accomplish?
<SeanTAllen>
also welcome greg__ !
<Greg__>
Hi SeanTAllen ! Thanks for the welcome :-). I was reading the following sentence in the tutorial "The programmers that wrote Bob and Larry don't even have to be aware that HasName exists." where Bob and Larry are classes and HasName is the interface
zakora has joined #ponylang
<Greg__>
consequently, before using an object of class (let say) 'Bob' as an interface 'HasName' I though there should be a way to make sure in your code that you can do it (and avoid compiler to be angry at me)
<Greg__>
Of course, I understand that I can't match on "let u: HasName => ..." since HasName is an interface and not a class.
endformationage has joined #ponylang
<Greg__>
hence my question, if a method accept an object which is an interface HasName, how can I make sure, without explicit declaration, that whatever the object sent to that method, it is compliant with the HasName interface
<Greg__>
maybe, it is not possible and that's the job of the compiler to let me know that object x is not HasName...
<Greg__>
I don't know if my question is clear enough. I'm not even sure if it makes sense :)
<SeanTAllen>
the compiler guarantees that
<SeanTAllen>
what you are asking is how you could find out at runtime
<SeanTAllen>
by then, the compiler would have already been mad at you
<Greg__>
yess indeed, I understand that. But let's say I want to test "if an object O is interface A: call method B with param O, else call method C with param O" ? Does that make sense? is that possible ?
jemc has joined #ponylang
<SeanTAllen>
there iftype which isnt documented yet because its still experimental
<SeanTAllen>
that said, what you are describing sounds very wrong
codec2 has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
<Greg__>
@SeanTAllen thanks for your answer. I fail to see why it sound very wrong, but I guess I still have a lot to learn ;)
<SeanTAllen>
greg__: what languages do you have a background with?
<Greg__>
hmm, mostly interpreted languages like python and php. I have some experience in C and (a bit) of C++ back in the days. I started learning pony to learn something new
<SeanTAllen>
can you explain what scenario you might want to see if something is a particular interface and then decide on a method to call based on that?
alxs has joined #ponylang
<Greg__>
it probably comes from my OO background where interface is a contract and you can pass any object as a parameter for instance whenever the class of that object respect the interface contract. Nevertheless, if you take php for instance, link between interface and class are explicit. Probably, what disturb me here is the structural subtyping isn't explicit.
<jemc>
"Of course, I understand that I can't match on "let u: HasName => ..." since HasName is an interface and not a class."
<Greg__>
I don't have a more specific scenario to provide other than that :)
<jemc>
greg__: you can definitely match on an interface
<jemc>
if you got a compiler error trying to do that, it was probably something else that was wrong
<jemc>
let me look at your gist
khan has quit [Quit: khan]
khan has joined #ponylang
<jemc>
greg__: here's a working modification of your example: https://is.gd/zipsWB
<jemc>
you were getting bitten by the fact that the default/implicit constructor for a class returns an `iso`
<jemc>
so I added `new ref create() => None` to make it so that your constructor returns a `ref`
<jemc>
it's not clear to me if you know about `iso` and `ref` yet with where you are in the tutorial, so I won't overload you with anything about reference capabilities yet
<Greg__>
@jemc oh great, thank you ! :) I see your changes. I've already read a bit about iso and ref,... But I know it is covered later on the tutorial !
acarrico has quit [Ping timeout: 240 seconds]
codec1 has quit [Read error: Connection reset by peer]
acarrico has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
zakora has quit [Quit: WeeChat 1.9.1]
nisanharamati has joined #ponylang
milisarge has quit [Ping timeout: 260 seconds]
maxd has joined #ponylang
dougmacdoug has joined #ponylang
alxs has joined #ponylang
maxd has quit []
Greg__ has quit [Quit: Page closed]
user10032 has joined #ponylang
patroclos has joined #ponylang
alxs has quit [Read error: Connection reset by peer]
alxs_ has joined #ponylang
khan has quit [Ping timeout: 240 seconds]
alxs_ has quit [Quit: Computer's gone to sleep. ZZZzzz…]
khan has joined #ponylang
_andre has quit [Quit: leaving]
vaninwagen has joined #ponylang
alxs has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
user10032 has quit [Quit: Leaving]
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
codec2 has quit [Read error: Connection reset by peer]
alxs_ has joined #ponylang
alxs has quit [Ping timeout: 256 seconds]
alxs_ has quit [Quit: Computer's gone to sleep. ZZZzzz…]