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
atk has quit [Quit: Well this is unexpected.]
atk has joined #ponylang
<doublec> aceluck: you need https://is.gd/A29atq
<doublec> aceluck: that is, you need to explicitly reference the 'y'
<doublec> aceluck: (in the first closure)
<aceluck> doublec: Thanks . Yes that's a workaround that works. I'm still of the opinion that this shouldn't be necessary though.
plietar has quit [Read error: Connection reset by peer]
<doublec> aceluck: I didn't even know you have access to variables in any scope - I thought you had to include them in that extra parameter always.
plietar has joined #ponylang
<doublec> aceluck: the fact that you can do that does confuse things
<aceluck> doublec: It'd be more in line with other languages if you didn't need to specify anything that you're using (whether it's nested or not)
<aceluck> In my code right now, the explicit capture list is 12 variables long and it's starting to look silly
<aceluck> (blame this book: https://letoverlambda.com)
plietar_ has joined #ponylang
plietar has quit [Read error: Connection reset by peer]
plietar has joined #ponylang
plietar_ has quit [Ping timeout: 240 seconds]
plietar has quit [Remote host closed the connection]
aceluck has quit []
jemc has joined #ponylang
aceluck has joined #ponylang
jemc has quit [Ping timeout: 260 seconds]
aceluck has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aceluck has joined #ponylang
aceluck has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
papey_lap has joined #ponylang
vaninwagen_ has joined #ponylang
vaninwagen_ is now known as vaninwagen
aceluck has joined #ponylang
_andre has joined #ponylang
aceluck has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aceluck has joined #ponylang
aceluck has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
plietar has joined #ponylang
jemc has joined #ponylang
jemc has quit [Ping timeout: 255 seconds]
jemc has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
plietar has joined #ponylang
adam_ has joined #ponylang
vak has joined #ponylang
<vak> hi all
<vak> as a newbie I didn't find neither in tutorial, nor in standard library docs nor (most sadly) in examples how to use collections in Pony. Are there any docs/links for a newbie?
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar_ has joined #ponylang
plietar has quit [Read error: Connection reset by peer]
<vak> Having all the variety of trn/iso/ref/box/... I am not quite sure which reference type is the natural one if sender-actor would like to store in a collection its recipients. Maybe I missed an appropriate example though?..
plietar_ has quit [Remote host closed the connection]
plietar has joined #ponylang
<vak> and the last question: are there any examples of graph rewriting/transformations using Pony? or at least any example to see what is the natural implementation of the graph in terms of actors?
plietar has quit [Read error: Connection reset by peer]
plietar has joined #ponylang
<jemc> vak: welcome!
<jemc> what kind of collections are you looking for?
<jemc> We have a `collections` package with various mutable collections to read about, and also `collections/persistent` with some immutable/persistent collections
<vak> jemc: hi, thanks for answering! Most importantly: lists, arrays, dictionaries(or maps) and sets
<jemc> also, `Array` is in builtin - you don't need to load a package to use `Array`
<jemc> the `collections` package has `List`, `Map`, `MapIs`, `Set`, and `SetIs`
<jemc> the distinction between `Map` and `MapIs`, is that `Map` uses structural equality to compare keys (such as the contents of a `String`), while `MapIs` uses identity equality to compare keys
<jemc> identity equality is particularly useful for objects which are not `Equatable`, or for opaque objects (such as references to another actor)
<vak> jemc: got it, many thanks
<jemc> so, for a `Sender` actor that needs to track a set of `Receiver` actors, I'd first reach for a `Set[Receiver]`
<jemc> err.. sorry
<jemc> a `SetIs[Receiver]`
<jemc> about your graph rewriting / transformations question - not sure we have any examples of that, but if you can be more specific about what problem you're trying to solve, I can probably give some useful guidance
<vak> jemc: I've seen a few occurrences of Array in examples they were all lifted with "recover ... end". I have to read more on Pony to understand why it is so wanted for Arrays to be "iso" in there
<vak> jemc: Pony looks very, very promising as an actor model oriented language. There are different actor-based approaches for graph algorithms, inspired by Bulk Synchronous Parallel. The Pregel from Google is one to mention
<vak> if a vertex of the directed graph is a Pony actor and the edges are stored as SetIs collection to its actor-receivers , how could one create an example of such a graph in Pony? it should be probably something like 10 lines
<jemc> one way to do it would be to make each actor implement a set of behaviours to modify it's receivers, like `be add_receiver(r: Receiver)` and `be remove_receiver(r: Receiver)`
<jemc> which would be implemented by calling `set` and `unset` on the internally-held `SetIs[Receiver]`
<jemc> vak: in this case, I think there's no need to lift the set or array to a higher capability, like `iso` or `val`
<jemc> you make decisions about what rcap (reference capability) to use for a reference based on how you need to us it
<jemc> *use it
<vak> jemc: ok, the operations on the graph you are writing about is even cooler than my first simplistic goal to be able to create some dummy static graph like A->B->C->A, for example like this 'looped" triangle :)
<jemc> in this case, your use case is a mutable set that is held privately within an actor, and never needs to be "sent" in a message across actor boundaries (or, if you ever do need to send this information, you'd want to make a copy, so you could keep your local copy and have it remain mutable)
<jemc> the requirement about being mutable limits your choices to `iso`, `trn`, and `ref`
<jemc> if it to be sendable, that would limit your choices to `iso`, `val`, and `tag` - meaning that the intersection of those constraints would force you to choose `iso`
<vak> jemc: many thanks about your rcap explanations, now I understand more
<jemc> but this one doesn't need to be sendable, so `ref` is okay
plietar has quit [Remote host closed the connection]
<jemc> `ref` is usually the most convenient rcap to work with, and should be your default choice for something that you're just working with inside a single actor
<jemc> especially for a beginner - the uniqueness rules around `iso` and `trn` can be difficult to wrap your head around
plietar has joined #ponylang
<vak> jemc: my understanding was that if one needs to store an "address" of the receiver-actor, then it should be "tag"... no?
<vak> jemc: ok, got it.
<jemc> right - you will hold a `tag` as your reference to each other actor, because that's the only kind of reference you can ever hold to another actor - its address
<jemc> but you need your `Set` to be mutable if you want to do transformations on the fly
<jemc> so you will have a `SetIs[Receiver tag] ref` - a mutable set of opaque references
<vak> jemc: wow. I see :)
plietar has quit [Ping timeout: 260 seconds]
vaninwagen has quit [Ping timeout: 240 seconds]
amclain has joined #ponylang
<vak> jemc: wow, it compiles and even runs... :) any comments on this my first stupid piece of code in Pony? https://pastebin.com/hWt7sUhp
<jemc> vak: you'll run into issues when you try to read the attributes in `EdgeAttributes` - you've created a `get_weight` method on that actor, but you can only call synchronous methods from *inside* the actor - everything exposed to other actors must be exposed as asynchronous behaviours
<jemc> based on how you're using it (shareable), I'd suggest making `EdgeAttributes` immutable
<jemc> to do that, rewirte `actor EdgeAttributes` as `class val EdgeAttributes`, and rewrite `new create(weight': F32)` as `new val create(weight': F32)`
<vak> jemc: thank you! actually it won't be "shared" in the future. Each edge should be rather unique
<jemc> I'd still suggest `val` is a good place to start
<jemc> another note is that you don't need to specify `Vertex tag` everywhere - an `actor` type will implicitly use the `tag` capability unless you specify a different one
<jemc> so you can just say `Vertex`
<jemc> a `class` type will use `ref` by default, though if you declare it as `class val EdgeAttributes`, you are changing that default to `val`
<vak> @jemc thank you, updated: https://pastebin.com/Ax9QjC7F
plietar has joined #ponylang
jmiven has quit [Quit: co'o]
plietar has quit [Ping timeout: 240 seconds]
jmiven has joined #ponylang
obadz has quit [Ping timeout: 240 seconds]
obadz has joined #ponylang
dtz has quit [Ping timeout: 240 seconds]
ada[m] has quit [Ping timeout: 255 seconds]
katafrakt[m] has quit [Ping timeout: 246 seconds]
M-hrjet has quit [Ping timeout: 264 seconds]
mindB has quit [Ping timeout: 276 seconds]
irx[m] has quit [Ping timeout: 276 seconds]
srenatus[m] has quit [Ping timeout: 258 seconds]
srenatus[m] has joined #ponylang
dtz has joined #ponylang
mindB has joined #ponylang
irx[m] has joined #ponylang
ada[m] has joined #ponylang
M-hrjet has joined #ponylang
katafrakt[m] has joined #ponylang
Matthias247 has joined #ponylang
plietar has joined #ponylang
plietar_ has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar_ has quit [Remote host closed the connection]
vak has quit [Ping timeout: 260 seconds]
plietar has quit [Remote host closed the connection]
plietar 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
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Remote host closed the connection]
_andre has quit [Quit: leaving]
Matthias247 has quit [Read error: Connection reset by peer]