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
trapped has quit [Ping timeout: 265 seconds]
aturley has quit [Read error: Connection reset by peer]
aturley has joined #ponylang
jemc has quit [Ping timeout: 252 seconds]
copy` has quit [Quit: Connection closed for inactivity]
brweber2 has joined #ponylang
jemc has joined #ponylang
brweber2 has quit [Quit: Textual IRC Client: www.textualapp.com]
SilverKey has joined #ponylang
aturley has quit [Read error: Connection reset by peer]
aturley has joined #ponylang
aturley has quit [Read error: Connection reset by peer]
aturley has joined #ponylang
jemc has quit [Quit: WeeChat 1.4]
SilverKey has quit [Quit: Halted.]
aturley has quit [Read error: Connection reset by peer]
aturley has joined #ponylang
gsteed has joined #ponylang
Dremalka has joined #ponylang
Dremalka has quit [Client Quit]
nyarumes has joined #ponylang
nyarum has quit [Ping timeout: 244 seconds]
aturley has quit [Read error: Connection reset by peer]
Matthias247 has joined #ponylang
aturley has joined #ponylang
aturley has quit [Read error: Connection reset by peer]
aturley has joined #ponylang
Matthias247 has quit [Read error: Connection reset by peer]
trapped has joined #ponylang
copy` has joined #ponylang
TwoNotes has joined #ponylang
<TwoNotes> Am I correct that 'a = b' implies "cloning the value" when b is a U32, but it is "create an alias" when b is a class object reference?
<TwoNotes> I think this involves the difference between 'let' and 'var'
jemc has joined #ponylang
<jemc> TwoNotes: from the perspective of the type system, the `=` is always aliasing the right hand side
<jemc> from the perspective of the implemetation,
<TwoNotes> But if a is 'var a: U32', don't I end up with a clone of the value?
<jemc> almost all objects in Pony are represented as pointers to an object, but the numeric primitives are a bit of a special case
<jemc> in the implementation, `=` is always just copying the value on the right hand side
<TwoNotes> Ok, so for anything not a numeric primitive, I have to use a .clone() function of some kind to really make a copy.
<jemc> most of the time, that means copying a pointer, so its an alias in the traditional sense
<jemc> but for numeric primitives, its represented as the actual value, so you're just copying the bytes of the value and not the pointer
<TwoNotes> I am trying to write some words on how a 'reference' is not like a 'pointer' and how 'copying' is not the same as "creating another alias'.
<jemc> well, what does it really mean to make a copy of a number?
<jemc> vs aliasing a number? what is the semantic difference?
<TwoNotes> Once it has been copied, it can be modified without affecting the original
<jemc> numbers can never be modified - they're always `val` - immutable
<TwoNotes> n = n + 1
<jemc> you're reassigning `n` to have a new value - you haven't modified the old value
<jemc> note that you can only do that with a `var`, not a `let`
<jemc> same is true if you're talking about a `val` object
<TwoNotes> Yes, I think of a 'let' as more of a 'compiler temporary value that has been assigned a name for convenience'
<TwoNotes> Ok, so conceptually, n=n+1 could be implemented as fetching the contents of the currefent 'n' reference, adding 1 to it, putting this somewhere new, and adjusting 'n' to refer to this new place.
<TwoNotes> If n==5 to start, by doing n=n+1 I have not changed the meaning of 5.
<jemc> right, but numerics aren't a special case in this way - the same would be true if you were using a `collections/persistent` `Map`
<TwoNotes> I am trying to describe this in a way that makes sense to programmers coming from other languages, who are not compiler theoreticians. *I* understand it becuase I have worked on a lot of compiler implementations and am used to such subtleties.
<jemc> the fact that numerics are implemented a bit differently from objects doesn't have an impact on the user (except when using FFI), because the ref cap system makes all `val` objects work this same way
<jemc> so I wouldn't think that you need to explain an implementation difference between numerics and non-numerics (except in an FFI tutorial)
<TwoNotes> If I had 'var n: U32 val = 5' then I would not be able to do n=n+1, right?
<jemc> no, you can do that - in fact it's the same as `var n: U32 = 5; n = n + 1`
<jemc> because numerics can only be created as `val`
<TwoNotes> I thought a 'val' reference can not be modified by any actor
<TwoNotes> 'var n: U32' is a 'ref', isn't it?
<jemc> "modified" is a fuzzy term in this context, and should probably be avoided, because we have two separate concepts that are important to distinguish: "reassignment" and "mutation"
<TwoNotes> ahhh
<jemc> TwoNotes: no, anywhere you see `U32` it is always `U32 val`
<jemc> so `var` vs `let` deals with reassignment, and mutation deals with `val` vs other ref caps
<TwoNotes> I got that now. ok. But now the difference between 'reassignment' and 'creating an alias'...
<jemc> not much of a difference - from the type system's point of view, "assignment" always creates an alias
<jemc> but there are a few wrinkles that make this a little more subtle
<TwoNotes> Doing a 'let' always creates an alias, but it does not do reassignment.
<TwoNotes> You can not take an 'addressof' of a 'let', because there is no 'there' there. It is not necessarily stored anywhere
<jemc> one is that some types alias as themselves with no problems (ref, box, val, tag), because they have no uniqueness restrictions, so aliasing them doesn't matter much, which you can't alias the other ref caps (iso, trn) as themselves since they have a uniqueness restriction
<jemc> I wouldn't quite describe it that way
<SeanTAllen> let and var are about name bindings
<jemc> the compiler doesn't let you take an `addressof` of a `let`, because the only reason to do this is for FFI, and doing so would make it possible for the FFI function you call to reassign the `let`, which is not allowed
<jemc> that is, passing the address of a local variable is the common C way of allowing the function to change your local variable, and Pony allows that only for `var`, not `let`
<TwoNotes> ok
<TwoNotes> I did a lot of work on the BLISS language 40 years ago, and the distinction between a 'name' and a 'value' was very explicit there.
<jemc> TwoNotes: I think you may be overthinking `let` vs `var` - it's pretty much exactly the same as these keywords are in javascript and other languages
<TwoNotes> So a 'hat' type is a reference with no alias yet, correct?
<jemc> the `hat` is a way to cancel out the aliasing - it's sort of like an anti-alias - the alias of A^ is A, and the alias of A is A!
<jemc> but yes, the "hat" indicates that value is ephemeral and is not bound to any name
<TwoNotes> So the value of a 'consumed iso' is iso^ ?
<jemc> yep
<ohir> jemc: I wonder if it is enough good as a reference (in your opinion)
<jemc> I haven't read through that post yet, but I know sylvan read it and liked it
<ohir> jemc: thx, thats enough
<jemc> from a quick scan, it looks quite nice to me
<TwoNotes> I found it quite useful
copy` has quit [Quit: Connection closed for inactivity]
jemc has quit [Quit: WeeChat 1.4]
jemc has joined #ponylang
SilverKey has joined #ponylang
Matthias247 has joined #ponylang
TwoNotes has quit [Ping timeout: 265 seconds]
SilverKey has quit [Quit: Halted.]
jemc has quit [Ping timeout: 246 seconds]
SilverKey has joined #ponylang
SilverKey has quit [Quit: Halted.]
copy` has joined #ponylang
SilverKey has joined #ponylang
TwoNotes has joined #ponylang
<nyarumes> Hey, why our http server so slow by default?
<nyarumes> 49.75
<nyarumes> r/s
<nyarumes> from wrk tool :)
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ponylang
aturley has quit [Read error: Connection reset by peer]
aturley has joined #ponylang
<SeanTAllen> the http server was designed as a proof of concept. nyarumes. no one should be using that for anything other than playing around.
<SeanTAllen> the only thing it should be used for is learning how to write something like it, not for actual performance of it.
SilverKey has quit [Quit: Halted.]
<TwoNotes> Important in servers that give out volumes of data is to minimize copying. Peek carefully into the Array and String classes for 'clone' operations.
SilverKey has joined #ponylang
aturley has quit [Read error: Connection reset by peer]
TwoNotes has quit [Quit: Leaving.]
bbhoss has quit [Ping timeout: 250 seconds]
darach has quit [Read error: Connection reset by peer]
bbhoss has joined #ponylang
darach has joined #ponylang
aturley has joined #ponylang
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ponylang
aturley has quit [Read error: Connection reset by peer]
aturley has joined #ponylang
gsteed has quit [Quit: Leaving]
<nyarumes> TwoNotes: it is just Hello World :D
<nyarumes> SeanTAllen: but 49 req/s it is O_o
<nyarumes> Go give without optimisations - 79k req/s
trapped has quit [Read error: Connection reset by peer]
SilverKey has quit [Remote host closed the connection]
SilverKey has joined #ponylang