jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang | Please consider participating in our mailing lists => https://pony.groups.io/g/pony
<doublec> jmiven: yes, good catch, thanks
aceluck has quit [Remote host closed the connection]
amclain has quit [Quit: Leaving]
jemc has quit [Ping timeout: 255 seconds]
jemc has joined #ponylang
plietar has joined #ponylang
jemc has quit [Ping timeout: 255 seconds]
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
aceluck has joined #ponylang
Praetonus has quit [Quit: Leaving]
aceluck has quit [Ping timeout: 255 seconds]
jemc has joined #ponylang
jemc has quit [Client Quit]
jemc has joined #ponylang
jemc has quit [Ping timeout: 255 seconds]
_whitelogger has joined #ponylang
aceluck has joined #ponylang
papey_lap has joined #ponylang
vaninwagen has joined #ponylang
Matthias247 has joined #ponylang
papey_lap has quit [Quit: WeeChat 1.9]
papey_lap has joined #ponylang
aceluck has quit []
jsc has joined #ponylang
jsc is now known as status402
bimawa has joined #ponylang
status402 has quit [Quit: status402]
vak has joined #ponylang
<vak> hi all
<vak> are there any ready Pony code for usual "actor protocols" like: an originator proposes to subcontractors to do a "thing" they may agree and provide a callback behaviour for this or they may reject originator's idea to do a thing?
Praetonus has joined #ponylang
vaninwagen has quit [Ping timeout: 246 seconds]
cousin_luigi has joined #ponylang
<cousin_luigi> Greetings.
<vak> hi cousin_luigi
<cousin_luigi> Still problems with gcc7. I don't understand where the "native" switch in this https://pastebin.com/c0rMHb6t comes from.
<cousin_luigi> Certainly not Makefile
<Praetonus> cousin_luigi: That should be `-march=native`. Not sure why the march part isn't there
<cousin_luigi> Praetonus: Uh oh, I think I did something.
<cousin_luigi> Praetonus: I changed BUILD_FLAGS, how is native still there if I erased -march=$(arch) ?
<cousin_luigi> and arch ?= native too
<cousin_luigi> LINKER_FLAGS too...
<Praetonus> That's not related to the Makefile. The link command for Pony programs is built by the compiler
<cousin_luigi> Is there anything that sets $(arch) to native by default?
* cousin_luigi changed genexe.c too...
<cousin_luigi> Uh oh, there's the problem...
<Praetonus> The compiler will build for the native architecture by default
<Praetonus> You can change that with the `--triple` and `--link-arch` compiler flags
<cousin_luigi> Praetonus: What does --triple do?
<Praetonus> It sets the target platform for the generated code
<Praetonus> In general it looks like `architecture-vendor-operatingsystem`
<Praetonus> For example, x86_64-pc-linux-gnu
<vak> "we do not draw the C distinction between forward declarations and full definitions" -- is the only thing that I've found regarding "type forwarding" or "forward type declaration"... How to do type forwarding for mutually dependent types?
jemc has joined #ponylang
<Praetonus> vak: There is no need for forward declarations in Pony. Types can refer to other types declared later in the file, or in another file in the same package
<vak> Praetonus: "syntax error: unexpected token _originator after type, interface, trait, primitive, class or actor definition _originator: Originator"
<vak> ah, forget it! :)
<vak> my wrong)
Matthias247 has quit [Read error: Connection reset by peer]
endformationage has joined #ponylang
obadz has quit [Ping timeout: 260 seconds]
obadz has joined #ponylang
<vak> to print from none-Main actors one should explicitly pass the env:Env?
<Praetonus> vak: Yes, or env.out if the actors don't need access to the rest of Env
<vak> oh...
* vak immediately jumped to the tutorial docs to see how to debug Pony programs...
<Praetonus> If you need to print only for debugging, you can look at the `debug` package
<vak> Praetonus: thank you!
<vak> Praetonus: debugging output is very important. For newbies like me it would be nice to see it in the tutorial.
<vak> also some hint on sprintf-like string operations... I guess it is done via @sprintf ?
<jemc> vak: I agree that `debug` package should be mentioned in the tutorial - can you file an issue in the `pony-tutorial` repo about that? https://github.com/ponylang/pony-tutorial/issues/new
<jemc> vak: regarding sprintf, pony supports varargs for FFI calls, but not in any pure Pony code, because varargs aren't typecheckable
<vak> jemc: https://github.com/ponylang/pony-tutorial/issues/210 is it ok to put it so?
<jemc> vak: thanks, that's just fine
kulibali has quit [Read error: Connection reset by peer]
<vak> that was fast about 211 :)
<SeanTAllen> jemc: i don't agree that Debug package should be mentioned in the tutorial. Or rather, I am wary of turning the tutorial into a "standard library discovery" tool. I detailed my thoughts on this issue. I think its a good conversation to have. Thanks for openin gthat vak.
<SeanTAllen> vak: you are just learning Pony now, correct? If yes, are you familiar with the "My First Pony" series and would you be interested in contributing?
<vak> SeanTAllen: i am totally new to Pony (albeit I am far not new to programming in general).
* vak is googling for My first pony...
<vak> jmiven: thank you because googling led me to the little girl's pony passion stuff only...
<SeanTAllen> its a series im starting where people write about their first couple weeks with Pony and we put it on the website. you interested?
aceluck has joined #ponylang
<vak> SeanTAllen: not yet sure :) Pony looks very, very much interesting, but after happy "relocation" from compiler languages to interpreter languages I am feeling kind of "claustrophobic" when returning to compiler languages, especially if no reflections provided in the language and it is statiacaly typed...
<vak> SeanTAllen: I do understand pro & cons of being statically vs dynamically typed
<vak> SeanTAllen: I'll do some notes, if it will become in something readable, I'll get back to you
<vak> "recover X end" converts X to iso rcap. how to convert X to tag rcap?
<aceluck> recover takes a keyword, so you can write recover tag X end
<jemc> `recover` is used to "lift" capabilities - by default it lifts to `iso` because it is the "highest" capability
<vak> thank you!
* cousin_luigi is seeing intermittent segfaults in the tests.
<jemc> vak: however, you don't need any special syntax to "drop" capabilities (except sometimes `consume` if you need to destroy a reference with uniqueness constraints, such as `iso` or `trn`)
<jemc> vak, aceluck: so `recover tag ... end` should never be needed - simply assign to the `tag` reference
<vak> as I see the problem wasn't in rcap incompatibility... :-/
<jemc> for example, `let foo': Foo tag = foo`
<jemc> cousin_luigi: the compiler tests, or the standard library tests, (or your own program/library's tests)?
<aceluck> jemc: Very true.
<jemc> I'd also ask, what OS are you on, what version of LLVM are you on, and what compiler version (or git revision) are you on
<jemc> looking
<cousin_luigi> jemc: openSUSE Tumbleweed and I'd say LLVM 3.8
<cousin_luigi> gcc7 in one case, but segfaults occur also with 4.8.something
<cousin_luigi> I tried disabling some of the failing tests, to no avail.
<jemc> cousin_luigi: hm, this snippet in the output seems interesting: `[ 133.463574] serial8250: too much work for irq4`
<cousin_luigi> jemc: I think that's only a problem when writing the log file, not compiling. But will ask OBS people for confirmation.
<jemc> cousin_luigi: the Leap and Tumbleweed outputs are showing a different issue, which I believe is fixed on master - I'll pull up the PR that should have fixed it
<vak> i am not able to pass Array of tags into behaviour. I hope my one-screen code snippet isn't too long, advices are very welcome: https://pastebin.com/xbRqcPWK
<jemc> cousin_luigi: this PR should fix the Tumbleweed and Leap issue, which affected the compiler test suite on some platforms, but was not causing bugs in the compiler or runtime itself: https://github.com/ponylang/ponyc/pull/2047
<cousin_luigi> Thanks, will retry with that.
<jemc> regarding your build flags patch - I'm not necessarily the best person to ask about that - I'd suggest filing a PR (or at least an issue ticket) with the patch for discussion
<jemc> if you file it in the next few hours, we can discuss it on today's sync call and get you an answer today
<aceluck> How long until the sync call? Or, what time, which timezone?
<jemc> (also, you can feel free to join the sync call if you wish - it's open to the public - you can find the link in the mailing list group)
<jemc> aceluck: it happens in 2 hours, 15 minutes, and has a duration of 1 hour
<aceluck> jemc: Thanks :)
<jemc> vak: there's a couple issues in your code:
<vak> jemc: thank you for looking at it!
<jemc> the first issue, which you're currently seeing the error for is that Pony generic types (like arrays) don't have any concept (yet) of covariance
<jemc> that is, even if `A` is a subtype of `B`, Pony doesn't see `Array[A]` as a subtype of `Array[B]`
<vak> oh
<jemc> so you need to specify in your array literal which element type argument you want to use
<jemc> the syntax would be: `[as SimpleSubcontractor tag: s]`
<cousin_luigi> aceluck: What is a sync call, exactly?
<jemc> vak: I actually have an open RFC that would allow that to be inferred from the left hand side, instead of having to be explicit in the array literal syntax: https://github.com/ponylang/rfcs/pull/96
<jemc> cousin_luigi: we get together weekly for an hour on a conference call to discuss open issues, pull requests, RFCs, and anything else Pony related
<vak> jemc: thank you. i am trying the changes...
<aceluck> cousin_luigi: It's a conference call where the pony developers (and their fans, like me ;) ) discuss ... well jemc beat me to it
<cousin_luigi> jemc: Alas my spoken English is not that good. Better if I stick with text.
<jemc> vak: the next problem you're going to hit is that having your Array be a tag, means that while it is sendable, it will be opaque - you can't read into it at all
<jemc> if you need sendable and readable, what you want is `val`, not `tag` for your `Array` - it will be immutable
<jemc> so what you want is `Array[SimpleSubcontractor tag] val` - an immutable array (`val`) of opaque actor references (`tag`)
<jemc> vak: hold on, sorry, I got your names backwards
<jemc> the syntax would be: `[as ISubcontractor tag: s]`
<jemc> and what you want is `Array[ISubcontractor tag] val`
<jemc> sorry for the confusion :#
<vak> the "[as ISubcontractor tag: s]" part i figured out on my own and was surprised a lot that array with two elements like this is no-go: [as ISubcontractor tag: s ; as ISubcontractor tag: s2 ] it throws an error on me "syntax error: expected value after semicolon"
<vak> jemc: but the other part that you wrote about s/tag/val -- this is what i am trying to understand now
<jemc> vak: for arrays with two elements, you still just have one `as` clause at the beginning
<jemc> (this is demonstrated in the tutorial if you want to look at it there)
<vak> jemc: got it, thank you!
<vak> sorry for missing this part in tutorial (it is huge...)
<SeanTAllen> thanks vak
<aceluck> jemc: Man, I think I'm getting too sleepy to join this time.. Good night!
aceluck has quit []
<vak> I was able to predefine some actor's logic in the interface and then provide this logic to the actor via "actor MyActor is MyInterface". So far so good. Now I'd like to make my interface "stateful" of course it is no-go.
<vak> So how could i predefine some common stateful logic for the actors?
<vak> (something like base class with a state variable)
<SeanTAllen> vak: the short answer is you don't. at least not the way you are thinking about it.
* vak understood and ...is puzzled
<SeanTAllen> your actor has to provide the field.
<SeanTAllen> you can access it from your interface trait via a method call
<SeanTAllen> im about to go on a call, i'll have some code for you in a bit
<vak> SeanTAllen: oh this is fully clear. But it means that all the variations of the actors that one is going to implement should have this common logic for this state variable -- all times the same...
<vak> oh, thank you!
<SeanTAllen> i dont really understand " But it means that all the variations of the actors that one is going to implement should have this common logic for this state variable -- all times the same..."
<SeanTAllen> perhaps i dont understand what you mean by "common logic"
<cousin_luigi> What does writevlarge do, exactly? The test keeps failing on some architectures, how large is the file actually going to be?
<vak> SeanTAllen: i've understood your example. it is exactly showing that each actor based on Fooable should all the times 1) define the field 2) define the field getter 3) define the field setter ...
<vak> SeanTAllen: if I dare to tell: i feel lack of "abstract actor" to put all this state field logic in there and then just say "actor MyActor is AbstractActorWithStateField" to avoid unneeded repeats in all "inherited" actors (i know we don't really inherit)
<jemc> vak: actually, another one of our new users recently wrote a blog post about this very subject, which you may find useful: https://medium.com/@KevinHoffman/more-composition-with-traits-and-state-in-pony-b8f0b8984f6c
<jemc> cousin_luigi: looking at the `files/File.writevlarge` test, it writes `(IOV_MAX + 10) * buf.size()` bytes, where `buf` is just a few bytes (the index number printed in decimal string, plus a newline character)
<cousin_luigi> jemc: I saw that. I'm not sure how large that is.
<cousin_luigi> Is it sensible to think that a failure would be more likely because of insufficient storage?
<jemc> cousin_luigi: after digging through a few headers on my own (64 bit linux) platform, `IOV_MAX` is 1024 for me
<jemc> so, not too much disk space...
<cousin_luigi> yeah
<cousin_luigi> It's failing on 32 bit platforms for me.
<cousin_luigi> Although not always.
<cousin_luigi> But on armv7 always. Unless its kvm has different defaults.
<jemc> can you file an issue ticket about it?
<jemc> at this point I want to make sure that info gets saved somewhere less ephemeral than IRC, so someone can take a look at it
<SeanTAllen> vaj: what you are describing is mixins. there are arguments in favor or mixins and arguments against. scala and ruby both feature mixins (as well as inheritance)
<cousin_luigi> jemc: I'm increasing the build constraints and trying again. Should it fail, I will file a ticket.
<jemc> great, thanks for looking into it!
<vak> jemc: thank you for the blog link! commented there. (Yeah, i know it is not an amazing attitude of the comment, but this is how i feel and i do hope it is not demotivating)
<cousin_luigi> jemc: #2059
aceluck has joined #ponylang
tinyurl_comSLASH has joined #ponylang
tinyurl_comSLASH has left #ponylang [#ponylang]
<vak> oops... i've added "fun ref is_registering_closed():Bool => _flag " thinking of it as ref getter and setter all at once. But attempt to assign "is_registering_closed()=0" immediately brought me to reality...
<vak> or is it not working for the premitives only?..
<vak> *primitives
papey_lap has quit [Ping timeout: 240 seconds]
<Praetonus> vak: The LHS of an assignement must be a local variable, a field, or a tuple of those things
<Praetonus> Pony doesn't have "lvalue references" as in C++ for example
<vak> Praetonus: understood, thank you. it means that building the stateful actor from treat/interface will need both setter and getter... ok.
<aceluck> vak: Be aware that any calls to actor behaviours are asynchronous, so a "getter" on an actor doesn't make sense. You might be wanting a class instead?
<vak> Praetonus: wait... but how then "invstorage().add(ob)" works in this blog post?.. https://medium.com/@KevinHoffman/more-composition-with-traits-and-state-in-pony-b8f0b8984f6c
<SeanTAllen> aceluck: i believe he would be using synchronous methods in this case. he wants some base logic in a trait/interface which means in order to access actor state, you need setters/getters to get at the state from within a trait/interface
<vak> aceluck: i am calling the fun from be, not vice versa
<aceluck> Okay :) I saw your comment out of context
<Praetonus> vak: The `invstorage()` call returns a reference to an object. You can call methods on such a reference but since it has no name, you can't reassign it
<vak> Praetonus: this was my idea, then i opened https://stdlib.ponylang.org/builtin-Bool/#bool to find methods to read from bool and set to it -- nothing found
<vak> so primitives will need both setter and getter, i see.
<Praetonus> Yes
<Praetonus> Conceptually, you can see numeric primitives as references to a number. e.g. Bool is a reference to either the value `true` or the value `false`. You can't change the value, only reassign the reference to refer to another value
<Praetonus> And reassigning is only possible on named references
_andre has quit [Quit: leaving]
<vak> Praetonus: i see, thank you
<vak> is there any possibility to turn on Debug in playground? http://pony-playpen.lietar.net/?gist=35bd5c6831c2c56b42aff082ac6418a2
<vak> this is my first pony-joy. I am pretty sure it is very much ineffective with wrong rcaps etc... but whatever :)
<SeanTAllen> @vak that seems like a reasonable idea to have it be a debug build. i'll talk to Paul about it. He maintains the playground.
<vak> SeanTAllen: thank you!
<SeanTAllen> given we dont care about speed in the playground, it seems like a rather reasonable idea
<vak> what i have learned today: the bridging from interfaces to the "stateful actors" is too unpleasant personally for me. Just take a look at those SimplePlan actor on the gist above, it is now almost 20 lines and it is all about "base logic", not the "inherited details"...
<SeanTAllen> abstract base classes are not a "normal" pony pattern @vak. and that is basically what you are trying to do.
<vak> yeah, probably...
amclain has joined #ponylang
<vak> gotta learn the pony way. maybe generics (the templates) here could help, i have to learn.
<jemc> vak: seems like your four field vars in `SimplePlan` could get stuffed into a single class, then you only need one getter method to expose that field to the trait
<vak> jemc: good point, thank you
<jemc> so your boilerplate would go from 4 fields, 8 methods, to 1 field, 1 method
<SeanTAllen> a more pony way would be to take that common logic and put it in an actor and then allow for the actor to be set up with either a typeparam or constructor param to specialize the behavior
aceluck has quit []
<SeanTAllen> but your mileage may vary with that based on your particular use case
<vak> I've got to re-flash my brain for the Pony, will look at this all tomorrow :)
<vak> many thanks for your support, guys!
<jemc> good luck!
<SeanTAllen> you're welcome vak.
<SeanTAllen> i havent actually tried it but it looks to me like reversing your relationship would be good
<SeanTAllen> have your basic logic in the actor, have a stateful class that is passed to the actor that implements state holding and specialized logic.
<vak> SeanTAllen: isn't the class you mentioned the same one that jemc mentioned a few lines above? or maybe I am misunderstanding your idea
<SeanTAllen> vak have you looked at the "notify" pattern that is used in the standard library?
<SeanTAllen> something along those lines is what i am talking about. which is very similar to the "strategy" pattern from the GOF book.
<vak> SeanTAllen: never have heard about it! my main source of knowledge is the tutorial. Notify wasn't mentioned there
<vak> SeanTAllen: there are many "notify" entries in there, but no somewhat generic ones...
<SeanTAllen> not sure what you mean by "generic ones"
<SeanTAllen> take a look at TCPConnection. It contains all the core TCPConnection logic then calls the user supplied TCPConnectionNotify at key points as needed to specialize actions.
<vak> SeanTAllen: i mean all of those "notify" entries found in std lib are rather in TCP context or stdin or alike
<SeanTAllen> im not sure what a "generic" one would be
<vak> oh, ok
<SeanTAllen> more on strategy pattern: https://en.wikipedia.org/wiki/Strategy_pattern
<SeanTAllen> there are many variations on that basic idea.
<SeanTAllen> its a very common specialization approach in pony as compared to trying to do something that looks like an abstract base class or "the template pattern"
<vak> i see. ok, gonna start from this tomorrow morning. thank you, SeanTAllen!
<SeanTAllen> you're welcome. i'll be around on and off if you need more help.
vak has quit [Ping timeout: 260 seconds]
Matthias247 has joined #ponylang
Matthias247 has quit [Read error: Connection reset by peer]
endformationage has quit [Quit: WeeChat 1.7]