aturley has quit [Read error: Connection reset by peer]
aturley has joined #ponylang
erip has joined #ponylang
erip has quit [Ping timeout: 250 seconds]
_whitelogger has joined #ponylang
endformationage has quit [Quit: WeeChat 2.3]
srenatus has joined #ponylang
a-pugachev has joined #ponylang
a-pugachev has quit [Quit: a-pugachev]
a-pugachev has joined #ponylang
_whitelogger has joined #ponylang
endformationage has joined #ponylang
ExtraCrispy has joined #ponylang
EEVV has joined #ponylang
<EEVV>
hello
ExtraCrispy has quit [Ping timeout: 256 seconds]
<EEVV>
I have a question: can I modify params of a function somehow? as in I would have `fun something(x: T)` and I would like to assign to `x` (ofcourse I can do `var x' = x`, but I don't want to rewrite code)
<aturley>
EEVV you can't do that
<EEVV>
okay, thanks
<SeanTAllen>
you can modify X if its mutable, but you cant do the specific thing you are asking
<SeanTAllen>
as in if x is an array, you can add and remove from it, if its mutable
<EEVV>
yes, I understand what you mean
<EEVV>
I am starting to like the language :) after I got past the challenges of not using blocking statements
<EEVV>
but one more thing: is it possible to do this `x = recover function(consume x) end`
<EEVV>
I'm trying to convert iso to val and then that returns a val which I convert back to iso...
<SeanTAllen>
you cant convert a val to an iso
<SeanTAllen>
val might have many different aliases to it
<SeanTAllen>
and the compiler doesnt do escape analysis
<SeanTAllen>
which would be rather slow
<SeanTAllen>
so once its a val, you would have to copy it to make it an iso
<SeanTAllen>
as in, the copy could be an iso
<EEVV>
hmm I thought recover means to copy?
<SeanTAllen>
no
<SeanTAllen>
it is not
<EEVV>
so is it only `box` that can be recovered?
<SeanTAllen>
no
<SeanTAllen>
so, recover, its like a "magic box"
<SeanTAllen>
the only things that are allowed in are sendable things
<SeanTAllen>
like val, tag
<EEVV>
I've seen stuff like `var x: Array[U8] iso = recover Array[U8] end`
<SeanTAllen>
and return the result as any reference type
<SeanTAllen>
Array[U8] is a ref
<SeanTAllen>
recover Array[U8] end
<SeanTAllen>
i can return that ref as an iso because...
<SeanTAllen>
nothing is allowed in that would make that problematic
<EEVV>
like specifically I have an issue with this `data' = recover aes.decrypt(consume data) end`
<EEVV>
`can't call method on non-sendable object inside of a recover expression` should I make `aes` sendable? val?
<SeanTAllen>
i cant tell you without seeing surrounding code
<EEVV>
another thing I find confusing is if an object is `Object val` can I use `fun ref` methods on it?
<SeanTAllen>
what is the type of aes with the refcap?
<EEVV>
type of aes is `AES`
<EEVV>
I think it is ref by default
<SeanTAllen>
right so if its ref
<SeanTAllen>
you can't use it in a recover block if its defined outside the recover
<EEVV>
in my `new create` I didn't specify capability
<SeanTAllen>
only sendable items
<EEVV>
hmm
<SeanTAllen>
right so new create is shorthand for new ref create
<SeanTAllen>
Object val, no you cant call fun ref methods on it
<EEVV>
hmm ok
<SeanTAllen>
its immutable
<SeanTAllen>
fun ref says "this can only be called on mutable things"
<EEVV>
maybe I can juggle some code to get it to work
<SeanTAllen>
why did you but the aes.decrypt in a recover?
<EEVV>
o crap, I was going to say it returns `Array[U8 val] val` but it actually returns `Array[U8 val]` so I guess implicit ref
<EEVV>
my bad
<EEVV>
also why does received give me Array[U8] iso and not Array[U8] iso^?
<SeanTAllen>
iso^ means there are no aliases
<SeanTAllen>
using it will create an alias
<SeanTAllen>
either passing as a parameter or otherwise binding it to a variable
<EEVV>
hmm
<SeanTAllen>
you can return an iso^ by consuming it when returning
<EEVV>
ok I get it
<EEVV>
yeah I have returned `iso^` before
<SeanTAllen>
but it will be immediately rebound to something
<SeanTAllen>
unless you are ignoring the return results
<EEVV>
what if internally into they did `received(conn, consume data, times)`
<EEVV>
ignore into typo
<EEVV>
so when I get to implement this function it would be `iso^`
<EEVV>
or am I still incorrec
<EEVV>
t
<SeanTAllen>
sorry, i dont understand
<SeanTAllen>
can you try saying that another way
<EEVV>
so what I mean is what if in the standard library
<EEVV>
it has to call `received(conn, data, time)` right?
<SeanTAllen>
that is called ues
<SeanTAllen>
that is called yes
<EEVV>
ok what if it did `received(conn, consume data, time)` consuming and giving iso^
<SeanTAllen>
iso^ isnt bound to anything
<SeanTAllen>
the parameter is something to be bound to
<SeanTAllen>
if it was iso^, then you can't do anything with it
<EEVV>
hmm right
<SeanTAllen>
iso^ is no aliases, not bound to anything
<SeanTAllen>
to access in received, it needs to be bound to data
<SeanTAllen>
so you can use it
<EEVV>
but I wish I could do `consume data` in my function, because you can do that with other variables that were momentarily bound, yes?
<SeanTAllen>
i dont understand
<SeanTAllen>
you can do consume data
<SeanTAllen>
if you are going to pass the data on to another actor, you would need to do consume data
<EEVV>
ok I'm sorry I forgot to consume in two if blocks...