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
aturley has quit [Quit: aturley]
aturley has joined #ponylang
_whitelogger has joined #ponylang
enilsen16 has quit [Ping timeout: 252 seconds]
enilsen16 has joined #ponylang
OtakuSenpai has joined #ponylang
_whitelogger has joined #ponylang
Foaly has joined #ponylang
travis-ci has joined #ponylang
<travis-ci> ponylang/ponyc#5522 (master - 7c44f14 : i-ky): The build was fixed.
travis-ci has left #ponylang [#ponylang]
Foaly has quit [Quit: Now 'mid shadows deep falls blessed sleep.]
srenatus has joined #ponylang
OtakuSenpai has quit [Remote host closed the connection]
OtakuSenpai has joined #ponylang
OtakuSenpai has quit [Ping timeout: 268 seconds]
_whitelogger has joined #ponylang
<srenatus> _andre: nice package. the README's "Google's uuid package" link doesn't lead anywhere, though; I was curious since I'm unaware of any Golang "uuid" package _by Google_. ;)
jdhorwitz has quit [Quit: Connection closed for inactivity]
OtakuSenpai has joined #ponylang
acarrico has quit [Ping timeout: 245 seconds]
Nawab has joined #ponylang
OtakuSenpai has quit [Read error: Connection reset by peer]
rjframe has joined #ponylang
acarrico has joined #ponylang
Shad0wCore has joined #ponylang
<Shad0wCore> Hey there. Is somebody there that can help me out with some stuff? I'm new to Pony and I'm having troubles with this 'iso', 'ref' etc. stuff
<Shad0wCore> Compiler's complaining
<Shad0wCore> Here's my code. What did I miss?
<SeanTAllen> hi Shad0wCore
<Shad0wCore> Hey there
<SeanTAllen> ive copied your code into a playground where its easier to work with, get errors etc: https://playground.ponylang.io/?gist=18051803946622b5529297326991dd9d
<SeanTAllen> looking now
<Shad0wCore> Thank you very much sir
<Shad0wCore> I'm coming from Java. I've got very little C++ background. I think I messed up with the capabilities stuff
<SeanTAllen> C++ probably wouldnt help there
<SeanTAllen> So, your intent...
<SeanTAllen> should loggers always be immutable? can you have a mutable logger?
<SeanTAllen> OR
<Shad0wCore> In my view a logger is always immutable
<SeanTAllen> ok
<SeanTAllen> so
<SeanTAllen> the error you are getting is that
<SeanTAllen> interface Logger
<SeanTAllen> by default, that says when you use "Logger" without a capability that its "Logger ref"
<SeanTAllen> So lines 16 and 20
<SeanTAllen> you are asking for a "Logger ref"
<SeanTAllen> but that's not what is being supplied
<SeanTAllen> I changes lines 16 and 20 to take a Logger box
<SeanTAllen> box basically allows for either val or ref
<Shad0wCore> Ok
<Shad0wCore> You kinda need to beef up the docs a bit because it is a bit hard to understand
<SeanTAllen> so
<Shad0wCore> Imho
<SeanTAllen> here's what is happening at a deeper level...
<SeanTAllen> you get this error:
<SeanTAllen> that's what is telling you that you want a Logger ref but you are supplying a PrimitiveOutStreamLogger box
<SeanTAllen> so PrimitiveOutStreamLogger ref would work there but not box
<Shad0wCore> So 'ref' is always the standard?
<SeanTAllen> for interfaces and classes, ref is the default
<SeanTAllen> for functions box is the default
<SeanTAllen> so...
<SeanTAllen> fun isDoorOpen(doorState: DoorState): Bool
<SeanTAllen> is a "box method"
<SeanTAllen> you can call it on anything that satisfies box
<SeanTAllen> there's a lot to this so i'm going to pause for a moment to let you think about it
<SeanTAllen> one last bit on that though
<SeanTAllen> if isDoorOpen mutates data, then i would do
<SeanTAllen> fun ref isDoorOpen(doorState: DoorState): Bool
<SeanTAllen> and if it can only be called on immutable things
<SeanTAllen> fun val isDoorOpen(doorState: DoorState): Bool
<SeanTAllen> this is all in the tutorial but you managed to stumble on it in an unfortunate way
<SeanTAllen> there are several ways to address this
<Shad0wCore> This screams for some sort of a cheat sheet, for beginners at least
<Shad0wCore> It'll take some time until I'm fit enough to add the "new" command to pony-stable
<SeanTAllen> it is in fact in the cheatsheet!
<SeanTAllen> so i'm going to change your code to match what I think your intent was and post that here although there are several possible ways to address, ok?
<Shad0wCore> Go for i t
<Shad0wCore> it*
<SeanTAllen> I added three `val` refcap annotations: https://playground.ponylang.io/?gist=dafe7ac75372aea6553e4aad5a1a71c5
<SeanTAllen> on line 1
<SeanTAllen> line 4
<SeanTAllen> and line 7
<SeanTAllen> take a look at let me know if i should explain any of those 3 vals i added
<Shad0wCore> Yeah, please explain it to me. I've still got Java keywords in my head and I'm trying to find any relationships to them with Pony keywords
<SeanTAllen> ok
<SeanTAllen> so line 1
<SeanTAllen> this says if I use "Logger" without a ref cap as a type that I mean "Logger val"
<SeanTAllen> so that makes line 16 and 20 where you use Logger no longer mean Logger ref it means Logger val
<SeanTAllen> does that make sense for line 1? (im building up to why all this fixes your compile error)
<Shad0wCore> Honestly, I don't understand a single thing when it gets to those caps. Guess I have to iterate over that tutorial over and over again until I understand it
<SeanTAllen> ok
<SeanTAllen> lets step back for a moment
<SeanTAllen> if i asked you to tell me what ref, val and tag are, could you explain them to me?
srenatus has quit [Quit: Connection closed for inactivity]
<Shad0wCore> Nope
<SeanTAllen> ok, have you seen this section on learning refcaps on the website? https://www.ponylang.io/learn/#reference-capabilities
<Shad0wCore> I mean I guess I can explain tag
<SeanTAllen> so next step is really to go through the process on the website
<Shad0wCore> The one you sent?
<SeanTAllen> yes
<Shad0wCore> Aight
<Shad0wCore> Gonna take a look at it
<Shad0wCore> Thank you
<SeanTAllen> start working through that and we'll be here to answer questions you have
<Shad0wCore> Thanks
<SeanTAllen> if no one answers right away, when you come back, check the logs
<SeanTAllen> we answer all questions (unless they are intentionally asshat questions)
<SeanTAllen> logs are here: irclog.whitequark.org/ponylang
<SeanTAllen> question... when you have done Java, have you done any programming using multiple threads?
<Shad0wCore> Barely
<Shad0wCore> I started with Java and I've been programming with Java the whole time
<Shad0wCore> I started learning C++ a month ago
<Shad0wCore> But meh
<SeanTAllen> ok
<SeanTAllen> so that really is the root of the problem
<SeanTAllen> refs caps are the compiler helpiing you with things that are important when you are doing concurrent programming
<SeanTAllen> if you want, i'm happy to go over that some now, although its in the referenced materials as well...
<Shad0wCore> First I'll have a look at the site you sent
<Shad0wCore> website*
<SeanTAllen> ok
<SeanTAllen> sounds good
<Shad0wCore> "We’re not going to pretend that all programmers know how to safely handle data when using threads. If they did, we wouldn’t need Pony." - This one got me
<SeanTAllen> "Even the most experienced programmer makes mistakes and they are really hard to go back and find."
<SeanTAllen> in the 90s when I was doing lots of multithreaded C++ programming, I came up with a lot of rules of thumb for how to handle data so that I didnt get data races and segfaults. They are fairly straightforward. The ref, val, and iso refcaps are basically a way for a compiler to help make sure those rules are followed.
<Shad0wCore> You must have had some headaches when designing Pony, didn't ya?
<SeanTAllen> I wasnt there for early design that was Sylvan. Although he and I have known each other for almost 30 years now.
<SeanTAllen> A few years ago, sylvan sent me a link to the pony tutorial and repo as it existed at the time with the message "look what i made!"
<SeanTAllen> a few months later I started playing with it and we decided it would be good for us to adopt at Wallaroo Labs and now I'm quite actively involved with Pony
<Shad0wCore> I've got another question. You know the pointers and reference stuff? Of course you do, you worked with C++. However, how is this done in Pony? Is there even "Pass by Value"? Is this handled by the caps?
<SeanTAllen> there's no pass by value in pony right now. although its something that there is ongoing discussion around
<SeanTAllen> everything is a reference
<Shad0wCore> Ok
<SeanTAllen> the compiler controls what you can do with those references
<SeanTAllen> so `val` it won't let you modify it
<SeanTAllen> `ref` it won't let you send to another actor
<SeanTAllen> `iso` it won't let you send to another actor without giving up your reference to it
<Shad0wCore> I'd love to see a cheat sheet showing of actual code. The first article by John Mumm is great and all but real long
<Shad0wCore> I mean realllllllll long
<SeanTAllen> if you could send a `ref`, that is a pointer that has many aliases to another actor then you could have 2 things concurrently accessing and/or updating mutable shared state and that is bad
<SeanTAllen> aturley did the cheatsheet. it's awesome.
<SeanTAllen> John is a very thorough human. I love working with him because of that.
<Shad0wCore> I guess I'll have to try different every time different caps because as of right now for me, trying to understand how those caps work is like studying for my finals lol
<Shad0wCore> different caps variations*
<Shad0wCore> lol
<Shad0wCore> the whole sentence is messed up
<Shad0wCore> I guess I'll have to try different caps combinations every time I encounter this problem, because as of right now, for me trying to understand how those caps work is like studying for my finals
<SeanTAllen> i would focus on 4 refcaps
<SeanTAllen> ref, val, iso, tag
<SeanTAllen> if you want an immutable thing, you want val.
<SeanTAllen> if you want a mutable thing that you can send to another actor or otherwise "share", then you want iso
<SeanTAllen> if you want boring old mutable that you keep within an actor, you want ref
<SeanTAllen> and tag is basically "the identity of a thing" which you can use for comparison and in the case of an actor, sending messages to
<Shad0wCore> Why can't I just do it like this? This makes way more sense for me, marking a parameter as "val" indicating: Dude, stop, you can only read from it. https://paste.md-5.net/culafabuhe.coffee
<Shad0wCore> It's just weird
<Shad0wCore> It's like with C++ const soup
<SeanTAllen> because PrimitiveOutStreamLogger isn't a val
<SeanTAllen> "PrimitiveOutStreamLogger box is not a subtype of Logger val: box is not a subcap of val"
<SeanTAllen> your PrimitiveOutStreamLogger is a ref
<SeanTAllen> and its being "seen" through a "box" method.
<SeanTAllen> so you get the error: "PrimitiveOutStreamLogger box is not a subtype of Logger val: box is not a subcap of val"
<Shad0wCore> You should also enhance the error messages a bit
<Shad0wCore> Something like "'PrimitiveOutStreamLogger box' is not a subtype of 'Logger val': Capability 'box' is not a subcap of 'val'"
<SeanTAllen> that's a good suggestion, can you open an issue for that?
<Shad0wCore> Yeah
<SeanTAllen> and it can be discussed
<Shad0wCore> On "ponyc"?
<SeanTAllen> yes please
acarrico has quit [Ping timeout: 250 seconds]
<Shad0wCore> I created an issue
acarrico has joined #ponylang
<SeanTAllen> thanks
Shad0wCore has quit [Quit: Page closed]
<SeanTAllen> stepping away
acarrico has quit [Ping timeout: 250 seconds]
rjframe has quit [Ping timeout: 240 seconds]
endformationage has joined #ponylang
Foaly has joined #ponylang
aturley_ has joined #ponylang
aturley has quit [Ping timeout: 250 seconds]
aturley_ is now known as aturley
Nawab has quit [Remote host closed the connection]
Foaly has quit [Quit: Now 'mid shadows deep falls blessed sleep.]
travis-ci has joined #ponylang
<travis-ci> ponylang/ponyc#5523 (master - 7c44f14 : i-ky): The build was broken.
travis-ci has left #ponylang [#ponylang]
endformationage has quit [Ping timeout: 250 seconds]
_whitelogger has joined #ponylang
Foaly has joined #ponylang
ExtraCrispy has quit [Ping timeout: 256 seconds]
Foaly has quit [Quit: Now 'mid shadows deep falls blessed sleep.]
acarrico has joined #ponylang
Shad0wCore has joined #ponylang
<Shad0wCore> Hey there
<Shad0wCore> Sean, you there?
<SeanTAllen> i am but probably not for long
<SeanTAllen> what's up?
<Shad0wCore> Is there something I could've done better? I started porting my project and I'd like to know your opinion on this class
<Shad0wCore> I tried the match expression because it looks better and is easier to read
<Shad0wCore> but the compiler complained again
<Shad0wCore> about the caps
<SeanTAllen> any reason for _NoEnvVars instead of None ?
<Shad0wCore> Good point... there....
<Shad0wCore> (facepalm)
<Shad0wCore> Fixed
<Shad0wCore> Thank you
<SeanTAllen> so i think this is your easiest thing... https://playground.ponylang.io/?gist=cd5e2218a340f3bcbd3f45dd8be198fa
<SeanTAllen> taking your general approach
<Shad0wCore> 'isnt' is a thing?
<Shad0wCore> holy moly
<Shad0wCore> Does not compile
<Shad0wCore> Nevermind
<Shad0wCore> I still had the "if"
<SeanTAllen> glad to help
<Shad0wCore> I'mma probably pop in multiple times over the days to ask for help
<Shad0wCore> Sorry for that
<SeanTAllen> no no
<SeanTAllen> that is 100% ok
<Shad0wCore> ok
<SeanTAllen> it's why we are here Shad0wCore
<SeanTAllen> do not apologize for needing assistance
<Shad0wCore> Ok
<SeanTAllen> we all need help with different things and the learning curve for pony is higher than many other programming tools
<Shad0wCore> Thank you Sir
<SeanTAllen> you're welcome
Shad0wCore has quit [Quit: Page closed]
<SeanTAllen> dinner time! i'm off.