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
aturley has joined #ponylang
aturley has quit [Ping timeout: 272 seconds]
trapped has quit [Ping timeout: 276 seconds]
SilverKey has quit [Quit: Cheerio!]
SirWillem has quit [Ping timeout: 276 seconds]
runehog has quit [Remote host closed the connection]
runehog has joined #ponylang
jemc has quit [Ping timeout: 250 seconds]
jemc has joined #ponylang
jemc has quit [Client Quit]
jemc has joined #ponylang
jemc has quit [Ping timeout: 264 seconds]
aturley has joined #ponylang
jemc has joined #ponylang
aturley has quit [Ping timeout: 244 seconds]
jemc has quit [Ping timeout: 260 seconds]
SirWillem has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 264 seconds]
c355e3b has quit [Quit: Connection closed for inactivity]
jemc has joined #ponylang
SilverKey has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 246 seconds]
SirWillem has quit [Ping timeout: 244 seconds]
jemc has quit [Ping timeout: 276 seconds]
aturley has joined #ponylang
unbalancedparen has quit [Quit: WeeChat 1.5]
aturley has quit [Ping timeout: 258 seconds]
rurban has joined #ponylang
copy` has quit [Quit: Connection closed for inactivity]
aturley has joined #ponylang
aturley has quit [Ping timeout: 276 seconds]
Matthias247 has joined #ponylang
srenatus has joined #ponylang
Matthias247 has quit [Read error: Connection reset by peer]
aturley has joined #ponylang
aturley has quit [Ping timeout: 260 seconds]
tm-exa has joined #ponylang
tm-exa has quit [Quit: Computer has gone to sleep]
tm-exa has joined #ponylang
tm-exa has quit [Quit: Computer has gone to sleep]
gsteed has joined #ponylang
rurban has left #ponylang [#ponylang]
hibnico has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 276 seconds]
tm-exa has joined #ponylang
lispmeister has joined #ponylang
trapped has joined #ponylang
hibnico has quit [Quit: hibnico]
lispmeister has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
aturley has joined #ponylang
lispmeister has joined #ponylang
aturley has quit [Ping timeout: 240 seconds]
Praetonus has joined #ponylang
hibnico has joined #ponylang
hibnico has quit [Quit: hibnico]
c355e3b has joined #ponylang
tm-exa has quit [Quit: Computer has gone to sleep]
rurban has joined #ponylang
rurban has left #ponylang [#ponylang]
hibnico has joined #ponylang
tm-exa has joined #ponylang
tm-exa has quit [Ping timeout: 260 seconds]
aturley has joined #ponylang
aturley has quit [Ping timeout: 252 seconds]
<shepheb> Gameboy, not NES, but yeah. it's slightly outdated Pony, and I got stuck on (probably SDL-related) segfaults. I never got it displaying anything properly.
<shepheb> SDL is a fairly nice API for Pony's FFI to interface with. no globals, modest number of macros, simple types.
<shepheb> but it's also probably not what you want for building a GUI.
<shepheb> or maybe it is. I've been fighting for 20 minutes with CSS to do something that's a one-liner in Android's layout model.
aturley has joined #ponylang
aturley has quit [Ping timeout: 276 seconds]
<SeanTAllen> CSS made me so happy when I first encountered it and now... it drives me insane.
<SeanTAllen> I'm rather happy to not be doing anything on the web front end these days.
tm-exa has joined #ponylang
SilverKey has quit [Quit: Halted.]
tm-exa has quit [Quit: Computer has gone to sleep]
unbalancedparen has joined #ponylang
<shepheb> my day job is working on a metaprogramming framework based in Javascript. I'm the team's expert on dealing with CSS and dumb DOM layout stuff, too.
<shepheb> (that's the only kind of DOM layout)
hibnico has quit [Quit: hibnico]
hibnico has joined #ponylang
SilverKey has joined #ponylang
tm-exa has joined #ponylang
andreaa has joined #ponylang
<shepheb> I wish I could hide an iso inside a val, to cache results
<shepheb> the "observed" behavior would be val; the calculation yields the same results every time.
<shepheb> but pre-computing everything is expensive, and so is re-computing every time.
copy` has joined #ponylang
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 246 seconds]
aturley has joined #ponylang
aturley has quit [Ping timeout: 240 seconds]
<mcguire1> I've got a goofy capability question:
<mcguire1> Suppose I have an Array[U8] ref that I'm using as a buffer: appending more U8's to it when they come in.
<mcguire1> I want to apply a regex to the buffer (and then I'll pull off the prefix that matches).
<Candle> mcguire1: and you want to get a String out of it? :)
<mcguire1> No :-)
<mcguire1> So I have
<mcguire1> let b: Array[U8] ref = ...
<mcguire1> regexp(b)
<Candle> mcguire1: heh. Remember that U8 != character.
<mcguire1> ...which won't compile because regex.apply takes an Array[U8] val.
<mcguire1> Do I *have to* copy my array before I can feed it to the regex?
<mcguire1> Candle, if 7 bits were good enough for grandpa, 7 bit characters are good enough for me.
* Candle has a similar problem, so I'm all eyes!
jemc has joined #ponylang
<Praetonus> mcguire1: You have to start with either an Array iso or an Array trn
<Praetonus> And consume it when passing it to the regex function
SilverKey has quit [Quit: Halted.]
tm-exa has quit [Quit: Computer has gone to sleep]
<mcguire1> That's what I was afraid of. :-)
<mcguire1> Makes sense, I guess. Wouldn't want changes to the array to be modifying the Match.
<shepheb> looking at it slightly differently: there could be an alternative API that only needs a String box for the regex
<shepheb> but that API would have to copy the string for the matches, or risk them changing in the background.
<shepheb> val is the only correct capability for the match. this API is more flexible - you can do a copy or prove val-ness with consume.
<shepheb> my streaming JSON parser does a similar thing - it needs a val input string, because it does a lot of indexing into the string to minimize copying.
SilverKey has joined #ponylang
aturley has joined #ponylang
<jemc> shepheb: regarding caching results of an expensive val computation - yes, I've been trying to brainstorm about the same thing
<jemc> Pony currently doesn't have a good way to approach this "lazy val" use case, I think
aturley has quit [Ping timeout: 260 seconds]
<jemc> I was thinking that theoretically the Pony compiler could do this transparently for functions `fun val` functions that have no arguments, since they can only depend on the internal state of an object which is never going to change
<shepheb> it feels sort of like Haskell's unsafePerformIO
<jemc> from a point of view of calculating the same result, that should always be safe, but it has another problem
<shepheb> it breaks the safety guarantees, because sometimes there are things the human can prove (to themselves) are safe, but not to the type system.
<jemc> that is, a `fun val` with no arguments, could still have *side effects* (like a call to another actor) which could not be optimized away automatically while maintaining correctness
<jemc> well, I don't think an "unsafe" escape hatch is what we need - that's a big blunt, menacing tool when we're trying to solve a specific problem
<shepheb> no, I don't think that's the right thing here either.
<shepheb> but that's sort of what it feels like. one common use of unsafePerformIO in Haskell, for example, is to do I/O once and save the result as a constant
<shepheb> that you don't need IO to access, even though the value was computed at startup or whatever.
<Praetonus> We already have an algorithm to check if a particular function can send a message, that could be used in an optimisation pass
<shepheb> for example, fetching your own PID
<jemc> Praetonus: interesting!
<jemc> so, `fun val` which takes no arguments and sends no messages => memoizable?
<Praetonus> It must also not do any FFI I think
<jemc> the remaining question would be, "is it *worthwhile* to memoize this?" - we don't want to memoize trivial operations, as that puts us on the wrong side of a memory/time tradeoff
<shepheb> bonus keyword, fun val memoize foo(arg):result =>
<jemc> also, memoizing a result inside a shared val object is going to imply an atomic operation to make a safe swap of the result into the unfilled memo slot
<jemc> so there's a cost there as well that must be less than the cost of the operation if this is going to be useful
Praetonus has quit [Quit: Leaving]
<shepheb> that's always the case with memoization, and why automatic memoization is AI-hard.
<shepheb> programmer annotations seem like the way to go, I think.
<shepheb> my work project's metaprogramming stuff includes a helper function that can wrap another, but that's easier to express in Javascript than in Pony.
<shepheb> when it's easy to use, you find lots of places where it's helpful.
<jemc> yeah, the previous language project I was spending most of my time working on made heavy use of decorators to express most language semantics in a user defined way
<jemc> the emphasis on all of that being defined in user-space (but not being statically compiled) also made it ungodly slow :)
<shepheb> we do a lot of mind-bending metaprogramming magic to make this stuff performant-ish in Javascript, but it's an uphill battle.
<shepheb> and some things we'd like to do are too painful.
<jemc> when I reapproach that project, I'm probably going to rewrite a bunch of it from the ground up to be more static, and to maybe generate Pony IR in the backend
<shepheb> Javascript's prototype-based OO is great for dynamically augmenting things
rurban has joined #ponylang
amclain has joined #ponylang
runehog has quit [Remote host closed the connection]
SilverKey has quit [Read error: Connection reset by peer]
SilverKey has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 252 seconds]
SilverKey has quit [Quit: Halted.]
lispmeister has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
SilverKey has joined #ponylang
SilverKey has quit [Client Quit]
SilverKey has joined #ponylang
hibnico has quit [Quit: hibnico]
SilverKey has quit [Client Quit]
SilverKey has joined #ponylang
<shepheb> still wish we had a better solution for building a Map[U32, Array[Foo val] val] val
<shepheb> building the outer map is fine
<shepheb> but if you're gradually assembling the inner arrays it's a pain to make them val as well
<shepheb> I haven't found a way other than building a Map[U32, Array[Foo val] iso] iso and copying the inner arrays.
<shepheb> er, consuming them.
<jemc> note that any capability (except tag) is seen as `val` when viewed from a `val` origin
<shepheb> does that apply to things in a Map? it never seems to for me.
<shepheb> let me keep fiddling with it.
<jemc> as an example, try building a `Map ref` of `Array ref`s inside one big `recover` block that recovers to `val` - if my off-hand thinking is correct, it should work
<jemc> you might have to amend the strategy a bit (and the ref caps) of you can't use one big `recover` block, but the idea is there
<jemc> regarding whether viewpoint adaptation works for collections like `Array` and `Map` - yes, it must, or the Pony world falls apart :)
<shepheb> I guess one question is: should the type outside the recover block be Map[U32, Array[Foo] val] val?
<shepheb> or should the inner cap be iso or ref or something?
<jemc> for `List` and `Map`, it is enforced by the compiler, but since `Array` does pointer magic internally, we must take special care to preserve viewpoint adaptation
<jemc> you can see the viewpoint adaptation at work in the function signatures, with `this->A` in use: https://github.com/ponylang/ponyc/blob/master/packages/builtin/array.pony#L92
aturley has joined #ponylang
runehog has joined #ponylang
<jemc> shepheb: whipped up a quick example to show you what I mean (and confirm that the caps work)
aturley has quit [Ping timeout: 258 seconds]
<shepheb> hm. I eventually got it working. it's a bit weird (to me) that the final type is Map[U32, Array[Foo] ref] val
<shepheb> I would've expected val] val
aturley has joined #ponylang
rurban has quit [Quit: Leaving.]
<jemc> right, that's the part I had to check by compiling with the gist
<shepheb> I've got it working, and achieved the main goal: only one iteration through this loooong array
<shepheb> I'd rather populate three maps as I move over the array once, than repeatedly process the array.
<jemc> so yeah, the inner cap is mutable the viewpoint adaptation can be counted on to do the work of returning an immutable on access
<shepheb> still surprising, but it works. argh, this is really tanking my startup time to precompute it
<jemc> interesting type theory question - should `List[List[A val] val] val` be a suptype of `List[List[A val] ref] val`?
<jemc> *subtype
<shepheb> I guess the type can't really know that there's no way to get the ref version out.
<shepheb> or maybe it can? the outer val promises that no one can edit the outer object or any of its members, etc.
<shepheb> that's a transitive relationship, so maybe?
aturley has quit [Ping timeout: 272 seconds]
<jemc> well, I'm thinking the type system doesn't know enough about how you *use* the type parameter to be sure
<jemc> for example, the type parameter for collections means you are composing the inner type inside the outer type, but not all type parameters will mean this
<shepheb> yeah.
tm-exa has joined #ponylang
<shepheb> argh, I need to do something else; this is destroying my memory usage.
<shepheb> I'm unhappy generally with my memory use here. the data on disk weighs in at ~300MB but it uses well over 5x that at runtime.
tm-exa has quit [Quit: Computer has gone to sleep]
tm-exa has joined #ponylang
tm-exa has quit [Client Quit]
<SeanTAllen> shepheb: sylvanc is tracking down a memory leak or two that i have identified
tm-exa has joined #ponylang
<jemc> shepheb: also, I'm not fully familiar with the current approach you've taken, but I would just mention that string copying is going to be a big killer, so avoid it if you can
<jemc> I'm hoping that this PR can help with zero-copy for use cases like this: https://github.com/ponylang/rfcs/pull/2
<jemc> at least, for JSON strings with no escape sequences you could take a trim instead of a copied/unescaped buffer
<jemc> I'm planning to use this approach in `pony-ast` (check for escape sequences, and use a zero-copy trim if none are present)
aturley has joined #ponylang
aturley has quit [Ping timeout: 246 seconds]
<shepheb> SeanTAllen: I don't think it's a leak, just me misusing it.
<shepheb> I've got a new plan that will work. instead of several maps, I'm just using a big table indexed as (row * row_size) + column, effectively[
<shepheb> they're almost but not quite dense, there's only a handful of gaps in either dimension
aturley has joined #ponylang
aturley has quit [Ping timeout: 272 seconds]
Matthias247 has joined #ponylang
tm-exa has quit [Quit: Computer has gone to sleep]
hibnico has joined #ponylang
SilverKey has quit [Quit: Halted.]
andreaa has quit [Remote host closed the connection]
andreaa has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 264 seconds]
SilverKey has joined #ponylang
<malthe> SeanTAllen: what do you think about organizing 'packages/net' such that each protocol lives inside a subdirectory?
<malthe> e.g. 'packages/net/tcp'.
<malthe> right now it's a bit mixed
<malthe> I also think that filenames can be shortened, e.g. '.../ssl/connection.pony' rather than '.../ssl/sslconnection.pony' etc.
<malthe> once pony hits 1.0 it's really hard to reorganize the standard library
<SeanTAllen> malthe: seems reasonable as long as it doesn't break anything. give it a go and see anything breaks.
<SeanTAllen> if it breaks we can figure it out from there
SilverKey has quit [Quit: Halted.]
<malthe> ya it won't break so much
<malthe> what about the ip4/ip6 constructors ... wdyt about a flag instead, i.e. restrict_ip_version which could optionally be set to a single version.
<malthe> there's a lot of clunky code duplication in some of the classes.
<malthe> kind of hard to avoid it without parameterizing the ip protocol version.
<SeanTAllen> thats RFC territory
<SeanTAllen> and a conversation around the pros and cons of existing approach
<malthe> right
<malthe> standard library needs some love, I do worry a bit about the rfc structure for changes here
<malthe> it makes sense for some parts, but possibly not for all
<malthe> (versus a healthy issue-based tracking)
srenatus has quit [Quit: Connection closed for inactivity]
<jemc> for some time, I've been wanting to address inconsistencies in file naming in builtin and stdlib
<jemc> we have documentation for standard library code style, but no such docs for file naming - we'd benefit from having some agreed-upon reproducible rules
<jemc> in general, I'm of the opinion that the file names should match the principal type name contained in the file, in some reproducible way
<jemc> haven't had time to flesh out a proposal for this though
<SeanTAllen> i'd be interested in seeing that jemc.
aturley has joined #ponylang
aturley has quit [Ping timeout: 250 seconds]
rurban has joined #ponylang
hibnico has quit [Quit: hibnico]
hibnico has joined #ponylang
hibnico has quit [Client Quit]
hibnico has joined #ponylang
SilverKey has joined #ponylang
gsteed has quit [Quit: Leaving]
runehog has quit [Remote host closed the connection]
<jemc> malthe: I agree that some of the net code could probably use some reform, but I think changes like that are *exactly* what we want to use the RFC process for
<jemc> we want a lot of eyes on our APIs, and transparency into the reasons for making decisions
<jemc> the RFC process is intended to help on both counts, giving everyone a chance to participate in the discussion or refer to a historical discussion later to understand what changed and why
<jemc> there are certainly more streamlined ways to make changes and decisions, but you often end up trading off on losing some opportunities for peer review and transparency
<jemc> I'm sure our RFC process isn't perfect yet, but I do want to try to make an honest effort to guide such changes through the process so we can better see the pain points and problems that still exist
trapped has quit [Read error: Connection reset by peer]
hibnico has quit [Quit: hibnico]
hibnico has joined #ponylang
<SeanTAllen> Well said jemc
aturley has joined #ponylang
aturley has quit [Ping timeout: 244 seconds]
rurban has quit [Quit: Leaving.]
SirWillem has joined #ponylang
SirWillem has quit [Remote host closed the connection]
Matthias247 has quit [Read error: Connection reset by peer]
hibnico_ has joined #ponylang
hibnico has quit [Ping timeout: 260 seconds]
hibnico_ is now known as hibnico
SilverKey has quit [Quit: Halted.]
runehog has joined #ponylang
hibnico has quit [Quit: hibnico]
aturley has joined #ponylang