<inanc>
hi! i wanted to learn about that is microsoft backing or supporting or financing ponylang? what's relationship of ponylang with microsoft?
<SeanTAllen>
there is no relationship between microsoft and pony. Sylvan works at Microsoft Research but there is no official relationship.
inanc has quit [Ping timeout: 260 seconds]
Matthias247 has quit [Read error: Connection reset by peer]
jemc has quit [Ping timeout: 240 seconds]
kushalp_ has joined #ponylang
hakvroot_ has joined #ponylang
yggdr- has joined #ponylang
kushalp has quit [Ping timeout: 252 seconds]
Zeedox has quit [Ping timeout: 252 seconds]
hakvroot has quit [Ping timeout: 252 seconds]
yggdr has quit [Ping timeout: 252 seconds]
kushalp_ is now known as kushalp
sjums has quit [Quit: Connection reset by beer]
sjums has joined #ponylang
Zeedox has joined #ponylang
graaff has joined #ponylang
mrkishi has quit [Ping timeout: 260 seconds]
Matthias247 has joined #ponylang
dom96 has quit [Changing host]
dom96 has joined #ponylang
graaff has quit [Ping timeout: 240 seconds]
graaff has joined #ponylang
abeaumont has joined #ponylang
ro6 has joined #ponylang
<ro6>
Let's say I have an `let arr = Array[Bool](1)` shouldn't I then be able to update that first reserved spot with `arr(0) = true` or `arr.update(0, true)`? Every time I try this in a test program it errors on the update attempt.
<ro6>
Essentially what I want is a sparse array. Is there another way to get that besides reserving sufficient space then using `update()` to set specific indexes?
<SeanTAllen>
Can you explain what you expect the Array[Bool](1) to do in that scenario ro6 ?
<ro6>
I was expecting it to allocate an empty array with space for at least 1 Bool value
<SeanTAllen>
ok, and how is that connected to the sparse array comment? i don't see the connection between the two.
<SeanTAllen>
can you send a gist of your code that isn't working for you?
<ro6>
Sparse as in I might allocate an array of size 5, then progressively update index 4, then 3, then 1
<ro6>
Writing the gist now
<SeanTAllen>
So the "Essentially what I want is a sparse array. Is there another way to get that besides reserving sufficient space then using `update()` to set specific indexes?" question is... is there a way other than how you just described "sparse" to achieve the same effect?
<SeanTAllen>
If you want to manage to not allocate memory for the union type I used, then you can't use Array and would need to create your own class. I think there would be interest in a "sparse array" class being part of the standard library. That would be something that would go through the RFC process
<ro6>
Ok, thanks for the info. I just took a look at the Array source and I see that it's throwing the error because the "bounds" it checks against depends on the "_size" variable, which is the amount of elements in the array, not the allocated size (https://github.com/ponylang/ponyc/blob/master/packages/builtin/array.pony#L129).
<SeanTAllen>
you're welcome
<ro6>
be functionally problematic.
<ro6>
In my case I can probably get away with filling the "empty" spaces with false to begin with. However, in general I wonder why the Array implementation doesn't check against the "_alloc" variable instead. Granted it would be weird to be able to ask for an array of size 5 then update at position 6, which the current implementation would allow, but it wouldn't
<ro6>
If you wanted to hide the implementation detail of space being reserved in a particular doubling pattern, you could store another field called eg _user_reserved to keep track of the size the user should be able to depend on . The class invariant would be _user_reserved <= _alloc
<ro6>
Does that sort of change need to go through an RFC process, or could I just submit a PR for consideration?
<SeanTAllen>
I don't understand what you mean by implementation detail of space being reserved.
<SeanTAllen>
Having to reallocate memory has performance considerations. To me that means its not an implementation detail. Its something I very much need to know about.
<SeanTAllen>
perhaps "implementation detail" has a different meaning to you than it does to me
<ro6>
No, I agree
<ro6>
I'm just saying that if the strategy were to change in the future for whatever reason, and a user of the Array class had depended on the prior allocation strategy, it would break the correctness of their code
Rishav has joined #ponylang
<SeanTAllen>
I think an RFC for a SparseArray that has different performance characteristics than Array would be more warmly received than such a change to Array.
<SeanTAllen>
even if we had any web frameworks (which we don't), "good" is rather subjective and would be hard to answer.
<SeanTAllen>
ro6: sorry, i'm having a hard time following that. i think i'd need a concrete example.
<Rishav>
sorry Sean. i went afk and then IRC logged me out
<Rishav>
:D
<SeanTAllen>
irrcloud is fairly inexpensive and great for that Rishav
<SeanTAllen>
you were still online when i gave that answer yesterday, a change in IRC client might help there too. even it logs you out, it should show you messages you received before being logged out.
<Rishav>
thanks anyway.
Rishav has left #ponylang [#ponylang]
<ro6>
SeanTAllen: I was just a bit surprised by the inability to write to an arbitrary location in an array that you know has been allocated. Coming from a lot of other languages it's pretty standard to be able to do that. I'll take a quick crack at rewriting the std Array class so people can see exactly what I'm referring to. If that leads on to a separate
<ro6>
SparseArray implementation, that's fine too. I think there's even further memory optimizations you can make if you know an array will be sparse.
<ro6>
The current implementation seems to be maintaining the invariant that elements (as well as allocated space) are contiguous
<SeanTAllen>
if an Array is 1 element in size, as far as I am concerned, saying update element 2 is an error. that is out of bounds.
<SeanTAllen>
it doesn't matter how much memory has been reserved for it.
<SeanTAllen>
in the example i put on your gist, this is explictly handled.
<SeanTAllen>
the Array is of Bool or None and is sized appropriately
<SeanTAllen>
I dont think there is any such inability, you just need to type it correctly
<SeanTAllen>
You could do Array[Bool] and as long as you initialize all the values our the where-ever you have allocated, you now have a valid array of that length
<SeanTAllen>
But I'm interested to see what you come up with
Matthias247 has quit [Read error: Connection reset by peer]
<SeanTAllen>
There are definitely space v performance trade offs that can be made data structures and having options available in the standard library to make those tradeoffs is a great thing
<SeanTAllen>
ro6: if you need any help, get stuck on any pony-isms, etc let me know. either here or via the mailing list and time permitting, i'll help as best i can
<SeanTAllen>
also are you aware of the development sync that happens almost every wednesday? we go over RFCS, PRs, issues and also have a discussion period. anyone in the community is welcome to join and encouraged to do so.
<ro6>
oh, great. I wasn't aware of that. I just found Pony a week ago or so.
<SeanTAllen>
if you join the pony-dev mailing list, you will get an email every week with info about the Sync.
<ro6>
great, I'll do that. Thanks
<SeanTAllen>
you're welcome
<ro6>
Now that I'm looking at it from the type perspective, I can see why it's built as it is now.
abeaumont has quit [Ping timeout: 240 seconds]
<SeanTAllen>
vaguely related to that
<SeanTAllen>
Pony's union types are very nice and easy to use
<SeanTAllen>
I appreciate that I can do (Bool|None) rather than having Some[Bool] or Maybe[Bool]
<SeanTAllen>
its a small difference but in the end somehow has had a dramatic impact on how I approach things
<SeanTAllen>
its hard to explain
<ro6>
Yeah. This would be the first language I've actually built something in that has that. The other one I'm aware of is Ceylon.
<ro6>
It's definitely convenient
<SeanTAllen>
For a while, MaybePointer was called Maybe and that lead to all sorts of confusion from folks who know Haskell (and Scala folks who know that languages have Maybe to correspond to Scala's Some)
TwoNotes has joined #ponylang
<TwoNotes>
Can PONYPATH be a list of directories?
<ro6>
SeanTAllen: Yep, that would have gotten me too.
<SeanTAllen>
TwoNotes: yes, see how pony-stable manages it