prettyvanilla has quit [Ping timeout: 260 seconds]
prettyvanilla has joined #ponylang
ro6 has joined #ponylang
_whitelogger has joined #ponylang
rurban has joined #ponylang
rurban has quit [Client Quit]
amclain has quit [Quit: Leaving]
rurban has joined #ponylang
Matthias247 has joined #ponylang
jemc has quit [Ping timeout: 240 seconds]
rurban has quit [Quit: Leaving.]
rurban has joined #ponylang
prettyvanilla has quit [Ping timeout: 240 seconds]
prettyvanilla has joined #ponylang
prettyvanilla has quit [Ping timeout: 255 seconds]
rurban has quit [Quit: Leaving.]
prettyvanilla has joined #ponylang
rurban has joined #ponylang
zevlg has quit [Remote host closed the connection]
rurban has quit [Client Quit]
rurban has joined #ponylang
rurban has quit [Quit: Leaving.]
rurban has joined #ponylang
wizeman has joined #ponylang
rurban has quit [Quit: Leaving.]
rurban has joined #ponylang
rurban has left #ponylang [#ponylang]
_andre has joined #ponylang
rurban has joined #ponylang
rurban has left #ponylang [#ponylang]
_whitelogger has quit [Ping timeout: 240 seconds]
ro6 has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #ponylang
graaff has joined #ponylang
aav has quit [Read error: Connection reset by peer]
TwoNotes has joined #ponylang
jemc has joined #ponylang
<SeanTAllen>
correct audio now uploaded
rurban1 has joined #ponylang
TwoNotes has left #ponylang [#ponylang]
rurban1 has quit [Quit: Leaving.]
rurban has joined #ponylang
rurban has quit [Client Quit]
pecan has joined #ponylang
amclain has joined #ponylang
ro6 has joined #ponylang
graaff has quit [Quit: Leaving]
<ro6>
I'm just getting started with Pony and really enjoying it. Out of curiosity, is it possible to create a private, actor-local type alias? I have a tuple of U8s and I'm trying to disambiguate them with types so I don't accidentally get the order wrong, similar to what one might do with 'newtype' in Haskell.
<ro6>
Or maybe there's a more idiomatic way to get that safety in Pony...
<jemc>
we only have the transitive style of type aliases - that is, if I declare `type A is U8`, `type B is U8`, then `A` and `B` are the same type from the perspective of the type system
<jemc>
regarding "private, actor-local" type declarations - we don't have that concept - we only have "private, package-local" type declarations (accomplished by prefixing with an underscore)
<ro6>
jemc: Gotcha. Thanks for the RFC pointer and the info!
<jemc>
actually, I take it back, you could set up a type-local type declaration using a type parameter
<jemc>
for example, `actor MyActor[A: U8 = U8]` would let you refer to `A` within the declaration of `MyActor` only
<jemc>
right
<ro6>
jemc: And by setting the default the compiler wouldn't require users of the actor to specify the param?
<ro6>
jemc: Would it allow them to override it though?
<jemc>
yes, but only within the constraint you provided (the term after the colon in the type parameter spec)
<jemc>
so in the case of my example, they could specify a type parameter, but it would be constrained by `U8`, so they could only ever specify a `U8`
<jemc>
(since `U8` is a concrete type)
<jemc>
it's somewhat of a weird use of type parameters to do this, but it might suit your purposes
<ro6>
Agreed. I might explore other options, was just hoping for something lightweight. I guess next best would be a class instead of a tuple?
<ro6>
Or an enum with two fields
<jemc>
depending on what exactly you're doing, a class might be more suitable, yes
<jemc>
I still don't think I know enough about what your larger use case is to provide a good recommendation beyond just answering your immediate question about a "private, actor local" type alias
<jemc>
also, I should have mentioned this earlier, but welcome! glad to hear you're enjoying Pony.
<ro6>
Thanks!
<ro6>
I'm actually trying to implement a parallel Game of Life out of actors to familiarize myself.
whitglint has quit [Remote host closed the connection]
<ro6>
I have no idea if my planned implementation is correct or fast yet, but I'm just trying to model it in a Pony-ish way. Each cell is represented by an actor that 'ticks' through time steps independently and notifies its neighbor cells about its 'aliveness' at each tick.
<ro6>
Inside each 'Cell' actor I keep track of notifications received from neighbors about their alive state at each tick, so the tuple of (U8, U8) is semantically ("Neighbors I've heard from", "Neighbors alive")
<jemc>
if it's internal state that each actor keeps, why not just keep two fields instead of one tuple field?
<ro6>
It's an array of those tuples
<ro6>
I might just be thinking about the parallel behavior wrong, but since Cells tick independently, I figured some neighbors might be sending notifications of their alive state at future ticks.
<ro6>
I guess I could keep two arrays..., that's just not how it came to my mind.
<jemc>
yeah, two arrays could be one option
<jemc>
what initiates a "tick"?
<ro6>
Once a Cell has received a reference to all 8 of its neighbors it sends them each a notification with it's current tick count and it's alive state. Once this Cell has received a notification from all 8 of its neighbors regarding their alive state for the tick this Cell is on, it ticks forward one step, updates its aliveness, and notifies all its neighbors.
<ro6>
Like I said, this is v1 and I'm still not completely convinced the parallel behavior of this is right, but it seems plausible in my mind...
<jemc>
seems intuitively like the communication between each pairing of neighbors is pretty much synchronous - with the logic of "move to the next tick as soon as all my neighbors have updated for this tick"
<jemc>
seems to imply that you won't get another notification from your neighbor until you've had a chance to acknowledge (and clear) the previous notification from that neighbor (and for all other neighbors in that tick)
<ro6>
I felt similar, just wasn't able to convince myself. I guess that means each neighbor pair can be at most one tick apart
<ro6>
Simplifies things
<jemc>
to test the theory you could always use the `assert` package to check the invariant - that is, at least it would make some noise for you if you ever receive a new notification from a neighbor before an old one is cleared
<ro6>
cool
kulibali has joined #ponylang
puzza007 has joined #ponylang
_andre has quit [Quit: leaving]
ro6 has quit [Quit: Connection closed for inactivity]
wizeman has quit [Quit: Connection closed for inactivity]
dougmacdoug has joined #ponylang
jemc has quit [Ping timeout: 268 seconds]
Matthias247 has quit [Ping timeout: 255 seconds]
Matthias247 has joined #ponylang
prettyvanilla has quit [Remote host closed the connection]