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
jemc has quit [Ping timeout: 255 seconds]
jemc has joined #ponylang
Matthias247 has quit [Read error: Connection reset by peer]
c355e3b has quit [Quit: Connection closed for inactivity]
jemc has quit [Ping timeout: 245 seconds]
amclain has quit [Quit: Leaving]
jemc has joined #ponylang
rurban has joined #ponylang
rurban has quit [Quit: Leaving.]
rurban has joined #ponylang
zevlg has quit [Ping timeout: 240 seconds]
jemc has quit [Ping timeout: 256 seconds]
TonyLo has joined #ponylang
<TonyLo> @jemc, thx for the info on zmq, sounds very promising, I'm lining up the pieces of a solution currently, so may be a little while before I am ready to use it in ernest. I will let you know how I get on with the API. Appreciate the offer of help.
rurban has quit [Quit: Leaving.]
<TonyLo> what is the correct way to call Array[T].init(): i am doing this:
<TonyLo> var el: TwoElement[T] = TwoElement[T](default, default)
<TonyLo> heap = Array[TwoElement[T]].init(consume el, n)
<TonyLo> but this leads to all array elements pointing to the same address, so making an update causes all elements to have the same value.
<TonyLo> I can manually initialise the array in a for loop and this works as ecpected.
<TonyLo> I checked the built-in tests but couldn't find a test for Array.ini()
<TonyLo> *Array.init()
Matthias247 has joined #ponylang
c355e3b has joined #ponylang
<SeanTAllen> yes, if you read the doc string for init
<SeanTAllen> ` Create an array of len elements, all initialised to the given value.`
<SeanTAllen> perhaps el.copy_to is what you want
<SeanTAllen> or
<SeanTAllen> create the new array and then append
<SeanTAllen> or maybe clone
<SeanTAllen> depends on the semantics you are looking for TonyLo
jemc has joined #ponylang
jemc has quit [Ping timeout: 256 seconds]
jemc has joined #ponylang
jemc has quit [Ping timeout: 240 seconds]
<TonyLo> @SeanTAllen, yes I agree, my expectation was that array.init would create a new element for each array element rather than copying the address of a single element to all the array elements (which is the only explanation I can find that fits the facts). I have tried with ephemeral and non-ephemeral objects but get the same result, i.e. array.insert(x, y) sets all the array elements to y not
<TonyLo> just element x. This only occurs if I use array.init and not if I insert the elements by index using insert.
<SeanTAllen> i dont understand your insert comment tonylo.
<SeanTAllen> insert takes two items. an index and the element to insert so
<SeanTAllen> a.insert(1, "a") will insert "a" at the first index.
<SeanTAllen> i'm not sure what the "if i use array.init()" means
<SeanTAllen> if you did array.init(y, 20) and then array.insert(x,y) then yes all elements will be y because that is what init does, it initializes all values to y.
TonyLo has quit [Ping timeout: 256 seconds]
<bougyman> p much
seanohue has joined #ponylang
TonyLo has joined #ponylang
<TonyLo> @SeanTAllen, if I array.init(y, 20) then array.insert(1, x) then ALL 20 elements of array are now x.
<TonyLo> @SeanTAllen, I have not be able to replicate this issue now, so it must be me! Sorry :)
Bombe has quit [Ping timeout: 252 seconds]
seanohue has quit [Ping timeout: 252 seconds]
Bombe has joined #ponylang
seanohue has joined #ponylang
seanohue has quit [Ping timeout: 256 seconds]
seanohue has joined #ponylang
carado has quit [Quit: ZNC - http://znc.in]
asdf_ has joined #ponylang
asdf_ has quit [Client Quit]
TonyLo has quit [Ping timeout: 255 seconds]