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
SenasOzys has joined #ponylang
SenasOzys has quit [Remote host closed the connection]
SenasOzys has joined #ponylang
SenasOzys has quit [Client Quit]
SenasOzys has joined #ponylang
SenasOzys has quit [Client Quit]
SenasOzys has joined #ponylang
SenasOzys has quit [Client Quit]
SenasOzys has joined #ponylang
SenasOzys has quit [Remote host closed the connection]
SenasOzys has joined #ponylang
SenasOzys has quit [Remote host closed the connection]
_whitelogger has joined #ponylang
_whitelogger has joined #ponylang
_whitelogger has joined #ponylang
_whitelogger has quit [Ping timeout: 250 seconds]
_whitelogger has joined #ponylang
Foaly has joined #ponylang
mahmudov has quit [Ping timeout: 268 seconds]
Foaly has quit [Quit: Now 'mid shadows deep falls blessed sleep.]
mahmudov has joined #ponylang
EEVV has joined #ponylang
<EEVV> hey what is a subcap error?
<EEVV> what is a subcap
<vaninwagen> I think it is analogous to a subtype: a sub capability
<vaninwagen> Something that a capability can be replaced with (i might not be 100% correct on this typesystem stuff)
<vaninwagen> If you give more context i could provide some more help EEVV
<EEVV> vaninwagen, I took a bit of a break from pony-lang, I was working on a project... I am changing the project a bit and I guess I messed up somewhere: I have a variable in my TCPConnectionNotify actor which stores a glorified array `ProtoBuffer`, most of the functions I do on the array are `fun ref`, but I tried setting the variable's type to `ProtoBuffer ref` with no luck
<EEVV> it says that my variable is `box` but I set it to `ref`... maybe the problem is deeper than this? I do not understand reference capabilities that well
<EEVV> I guess I mostly used the reference capabilities it wanted
Foaly has joined #ponylang
<EEVV> ok, I think I had to change a function to `fun ref` but I am still confused.... Is `fun ref` a function that will change the local variables?
<EEVV> I guess I'm just stupid lol
<EEVV> also is it possible to copy a `ref` type to `val` without doing it manually?
<vaninwagen> You are definitely not stupid
<vaninwagen> After all you are here
<vaninwagen> a fun ref is a function that can mutate fields on the receiver, yes
<vaninwagen> If you have a simple fun (without the ref) then this is fun box
<EEVV> vaninwagen, ok is it possible to copy `ref` to make a `val`?
<EEVV> without doing it by hand?
<EEVV> last time I think someone said there is an issue with it, but maybe it is possible now?
<EEVV> I am also confused on `recover` and `consume`
<EEVV> they seem to be opposites of each other, but why does `recover` take a block of statements?
<EEVV> maybe i am asking too much
<EEVV> cheat sheet says recover is to lift a capability and consume is getting rid of alias
<EEVV> ok I'll just ask last question and I will try to figure out other problems on my own. When should I create actors? Right now I am just doing as STD tells me to (TCPConnectionNotify is actor, etc..)
<EEVV> before you answer consider that I haven't used threading much elsewhere
<vaninwagen> fun box means, you only see the receiver (mostly known as this) as read-only, so you cannot modify any fields
<vaninwagen> EEVV: copying ref to val would be unsafe
<EEVV> vaninwagen, I mean in the same actor
<vaninwagen> Because a val is sendable, you can send it to another actor, while ref is not sendable, but doesnt restrict how many references you have locally
<vaninwagen> EEVV still not possible, because the compiler doesnt know too well
<EEVV> what I mean by copy is create an array that just has the same elements, I think deep copy is the word
<vaninwagen> This is definitely possible
<EEVV> Array[U8 val] ref ->> Array[U8 val] val
<vaninwagen> Sorry, i misunderstood you apparantly
<EEVV> I did it by using an Array[U8 val] iso, filled it with copies from the `Array[U8 val] ref` then consumed it to `val`
<EEVV> maybe there is a better way?
<EEVV> (consume a iso^ to be specific)
<vaninwagen> consume and recover are too different imho to be duals
<vaninwagen> consume gives up the reference passed to it and marks it as unusable, and it returns the consumed reference
<EEVV> vaninwagen, why can I not consume a ref^ to get val?
<vaninwagen> This is not hoe consume works
<vaninwagen> You would need recover for this
<EEVV> why not?
<EEVV> yes I used recover but I do not understand why
<vaninwagen> If you give up your ref reference using consume there could still be more refs around
<vaninwagen> So it is still unsafe
<vaninwagen> recover works in the following way:
<vaninwagen> It lets you convert between capabilities, if the conversion is still safe
<vaninwagen> The way from ref to val is safe, if we know there are no more references to the ref around
<EEVV> but I thought ref^ has no aliases?
<EEVV> are aliases not the same thing as references?
<vaninwagen> They are
<EEVV> so doesn't the `^` in ref^ say that it will not have extra aliases?
<EEVV> or I guess no aliases at all
<vaninwagen> In general this is how i thought about it too
<vaninwagen> But to be mord exact it is a unassigned reference floating around without a variable pointing to it
<vaninwagen> Kinda
<vaninwagen> So it doesnt say, there are NO OTHER references to the object it points to
<vaninwagen> Only in combination with iso
<vaninwagen> So, an iso^ is really without additional references
<EEVV> what about trn^?
endformationage has joined #ponylang
EEVV has quit [Quit: Page closed]
rurban has joined #ponylang
rurban has left #ponylang [#ponylang]
Foaly has quit [Quit: Now 'mid shadows deep falls blessed sleep.]
<vaninwagen> A trn is only write unique
<vaninwagen> There could be other read-only references (e.g box) to the same object
Foaly has joined #ponylang
endformationage has quit [Quit: WeeChat 2.3]
kulibali has quit [Quit: Page closed]
SenasOzys has joined #ponylang
SenasOzys has quit [Remote host closed the connection]
SenasOzys has joined #ponylang
rurban has joined #ponylang
rurban has left #ponylang [#ponylang]
Foaly has quit [Quit: Now 'mid shadows deep falls blessed sleep.]
SenasOzys has quit [Quit: Leaving]
rurban has joined #ponylang
endformationage has joined #ponylang
rurban has quit [Quit: Leaving.]