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
gokr has quit [Ping timeout: 276 seconds]
Jwashton has joined #ponylang
<Jwashton> o/ Greetings, all. I'm sifting through the examples folder, trying to make sense of what I can. I'm a little confused by the mandelbrot/gups_opt examples. Namely, I'm not sure how to get them to run.
<Jwashton> When I try to run `./gups_opt` I get "Error: missing subcommand at: 'gups_opt'", which makes sense for the `gups_opt [<options>] <command> [<args> ...]` signature.
<Jwashton> But from there things start to make less sense. The only "command" listed in the help is, well, help. Also, the Config class on line 5 of that file seems to use the command to set some options, but it looks to me like the command itself is dropped at the end of the constructor.
<SeanTAllen> There’s an issue to address
<Jwashton> Nice. One interesting piece to this is that both of these examples do have some minimal documentation already in the form of the cli "help" command. (For my own learning, it's nice to see how that was implemented. :) ) But that help seems to be misleading. Attempts to resolve this issue by adding new documentation might be aided by also amending the help output in the CLI.
jemc has quit [Quit: WeeChat 1.9]
Jwashton has quit []
mahmudov has quit [Ping timeout: 256 seconds]
mahmudov has joined #ponylang
mahmudov has quit [Ping timeout: 240 seconds]
khan has joined #ponylang
khan has quit [Remote host closed the connection]
khan has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
dipin has quit [Quit: dipin]
emgonam2 has joined #ponylang
dipin has joined #ponylang
dipin has quit [Client Quit]
user10032 has joined #ponylang
gokr has joined #ponylang
user10032 has quit [Quit: Leaving]
jmiven has quit [Quit: co'o]
jmiven has joined #ponylang
jnyw has joined #ponylang
khan has quit [Quit: khan]
vaninwagen has joined #ponylang
xllndr[m] has left #ponylang ["User left"]
gokr has quit [Read error: Connection reset by peer]
jnyw has quit [Quit: WeeChat 2.0.1]
_andre has joined #ponylang
mahmudov has joined #ponylang
mahmudov has quit [Client Quit]
mahmudov has joined #ponylang
codec1 has joined #ponylang
codec1 has quit [Ping timeout: 240 seconds]
codec1 has joined #ponylang
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
khan has quit [Quit: khan]
ShalokShalom has joined #ponylang
khan has joined #ponylang
alxs has joined #ponylang
codec1 has quit [Quit: Leaving.]
ShalokShalom has quit [Remote host closed the connection]
khan has quit [Client Quit]
khan has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
codec1 has joined #ponylang
mahmudov has quit [Remote host closed the connection]
codec1 has quit [Read error: Connection reset by peer]
khan has quit [Client Quit]
khan has joined #ponylang
khan has quit [Remote host closed the connection]
khan has joined #ponylang
jemc has joined #ponylang
emgonam2 has quit [Ping timeout: 248 seconds]
mahmudov has joined #ponylang
dipin has joined #ponylang
vaninwagen has quit [Ping timeout: 252 seconds]
mahmudov has quit [Remote host closed the connection]
<winksaville> @dipin, yt
<dipin> @winksaville, yes, what's up?
<winksaville> got a hang after about 20min using pthreads, and github is down
<dipin> k.. at least the signals variant worked without issue
<dipin> progress.. i think
<dipin> anything interesting in the backtrace?
<winksaville> yep, I'll post the gdb info on my public dir in google drive or email it to you or ....
<dipin> whatever works for you is fine with me
<winksaville> thread 1 is join as expected, thread 2 is epoll_wait as expected.
<winksaville> threads 3..7 are nanosleep
<winksaville> thread 8 is pthread_cond_wail
<winksaville> 8 Thread 0x7fd4c665e700 (LWP 23813) "stdlib" 0x00007fd4f239639d in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
<dipin> hmm.. that sounds like quiescence wasn't reached so thread 3 (sched->index = 0) never initiated shutdown
<dipin> hopefully we can see the internal state of "sched" for sched->index = 0.... that might give some insight as to why it didn't reach quiescence
<dipin> also, github just loaded successfully for me... not sure if it's fully back up though
<winksaville> 8 Thread 0x7fd4c665e700 (LWP 23813) "stdlib" 0x00007fd4f239639d in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
<winksaville> Add comment to 2483
<winksaville> I'm still in gdb if you want me to look at something else although this is a release build so *this_scheduler isn't available or at least for me is says "Cannot access memory ..."
<dipin> right.. ummm.. if you go up to frame 2 (run_thread) in thread 3... can you try printing "p *sched"?
<winksaville> k
<dipin> the "sched" variable should be pointing to the same thing as "this_scheduler"
<winksaville> No symbol "sched" in current context.
<winksaville> Frame 2 is run_thread:
<winksaville> #2 0x000055695cfce4a4 in run_thread ()
<dipin> oh well.. was worth a try... 8*/
<winksaville> Maybe I should re-run with a debug build?
<winksaville> so far we've been lucky that debug build seem to "break", of course our luck may change
<dipin> are you able to print the output of "pony_ctx()"?
<winksaville> How do I run pony_ctx?
<dipin> or, actually... run that and assign to a temporary variable..
<winksaville> (I'm a rank beginner with gdb :) )
<dipin> ummm... one sec... i know how to do it in lldb... in lldb it's "p pony_ctx()"
<winksaville> so "x = pony_ctx()" ?
<dipin> maybe the same works in gdb?
<winksaville> k
<winksaville> (gdb) p pony_ctx()
<winksaville> $1 = -244979640
<winksaville> IRC is terrible :(
<winksaville> is there a way to post multiple lines?
<dipin> can you try "p *$1"?
<dipin> no clue... i'm new to irc....
<dipin> also, i assume it might depend on the client
<winksaville> (makes two of us)
<winksaville> Cannot access memory at address 0xfffffffff165e848
<dlowe> there is not a way to post multiple lines
<winksaville> dumb
<winksaville> (I guess it lowers the spam level)
<dlowe> no, it was just easy to implement.
<dipin> okey.. we might have to temporarily add in a function to print the internals of "this_scheduler" so we have access to it for debugging even in a release build...
<dlowe> the irc protocol is line delimited
<dlowe> most clients will split newlines properly if you paste it in
<dipin> without access to that internal state, i don't think there's anything else for you to do in gdb @winksaville
<winksaville> k, you do that I'll try debug mode
<dipin> k, thanks
<winksaville> any other info before I get out of gdb?
<dipin> not that i can think of
<winksaville> k, I'll build with debug and we'll see what happens
<dipin> okey, thanks
<winksaville> good newsish if failed in less than a minute
<winksaville> Here is "p *pony_ctx()"
<winksaville> $1 = {scheduler = 0x0, current = 0x7fdcb639d800, trace_object = 0x556701accfe1 <ponyint_gc_sendobject>, trace_actor = 0x556701acd351 <ponyint_gc_sendactor>, stack = 0x0, acquire = {contents = {count = 0, size = 0, item_bitmap = 0x0, buckets = 0x0}}, serialise_buffer = 0x0, serialise_size = 0, serialise = {contents = {count = 0, size = 0, item_bitmap = 0x0, buckets = 0x0}}, serialise_alloc = 0x0, serialise_alloc
<dipin> just saw this
<dipin> @winksaville, can you print "this_scheduler"? I was asking for pony_ctx() earlier as a roundabout way of getting to this_scheduler
<winksaville> Going to add it as a comment
<dipin> k, thanks
<winksaville> posted comment
<dipin> looking now..
<dipin> just to confirm, this is after all of the normal stdlib output has completed printing, right?
Jwashton has joined #ponylang
<winksaville> yes its exiting, last output to terminal is "---- Passed: 277"
mahmudov has joined #ponylang
<dipin> i'm going to try and reproduce on my end and debug.. thanks @winksaville
<winksaville> k, we can try tmux if you can't reproduce on your side
<winksaville> let me know and feel free to concat me to bounce ideas off of
<dave24> if I have a `x : (U8 | U32)` is there a way I can determine which it is at runtime without a big `try x as U32; true else false end`?
<dipin> will do, thanks
<slfritchie> match x |let x8: U8 => /* do byte stuff with x8 */ |Let x32: U32 => /* do word stuff with x32 */ end
<slfritchie> dave24: ^^
<slfritchie> Errr, without the capital L on the 2nd'd "let", sorry.
Jwashton has quit [Remote host closed the connection]
Jwashton has joined #ponylang
<dave24> slfritchie: thanks
Jwashton has quit [Ping timeout: 256 seconds]
Jwashton has joined #ponylang
<Jwashton> What's the reasoning behind type Pony's type flexibility around case functions? I'm coming from an Elixir/Erlang background, so I'm used to FunctionClauseErrors being thrown if no matching clause is found. That seems like the sort of thing the Pony compiler could prevent with a little type safety. Am I just approaching these the wrong way, because they feel familiar?
<Jwashton> For example, in the FizzBuzz illustration in the tutorial all clauses of _fizz_buzz/3 take three U64s and return a String. Additionally (and critically) the last clause has no guards or other limitations, so it *will* catch all traffic. So why does the compiler still feel like it needs the return type to be (None | String)?
<slfritchie> jwashton: Pony gives you the option of adding an "else error" final clause at the end of a "match" if you wish it. Erlang implicitly includes it and you add a "_ -> ok_no_pattern_match_error end" clause if you wish.
<Jwashton> I think I can appreciate that. This still feels like the sort of error we can get at compile time, instead of making decisions about whether or not to opt-in to errors at run-time.
<Jwashton> slfritchie: But that's some helpful perspective. Thank you.
<slfritchie> I'm new enough to Pony to not know the subtleties of function clause pattern matching ... I don't see it in the code base that I work on (Wallaroo). But perhaps there's another type combination in the args that the compiler thinks could slip through those 4 clauses & thus has a default/implicit final clause that returns None? I'm not sure.
<slfritchie> Pony is all about avoiding runtime errors, whenever it can.
<Jwashton> At the top of the page the tutorial admits that different clauses of a function may have different parameter types. So all I have to do to slip through in this case is pass a string (or anything else) instead of a U64 to the first parameter. It almost feels like the concept of "type safety" got set aside for this feature. Any other function would have clearly defined input types and output types.
<Jwashton> So, yes, (None | String) makes sense as long as the compiler isn't checking.
nisanharamati has joined #ponylang
<Jwashton> Wait, nvm. I'm confusing myself. Once the function is defined I can't pass anything arbitrary to it. It still would need to be a type defined by at least one of the clauses, but the clauses may disagree. I'll re-read and be quiet now. ;)
<slfritchie> The Pony compiler isn't happy with strings in either 1st or 2nd position: https://playground.ponylang.org/?gist=a96694d18e77f7a2275106fd030286c0 ... mixing argument types arbitrarily like a BEAM language isn't permitted IIRC.
<slfritchie> So my "slip through those 4 clauses" statement above is probably misleading.
<Jwashton> slfritchie: Yes, I realize my mistake there. But that leaves me more confused as to why the compiler thinks you might return None from that set of clauses. If the types are well-defined, and a catch-all clause is given, then...
_andre has quit [Quit: leaving]
user10032 has joined #ponylang
jemc has quit [Ping timeout: 246 seconds]
khan has quit [Quit: khan]
khan has joined #ponylang
jemc has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
<SeanTAllen> jwashton: are you taking about case classes or just matching in general?
<SeanTAllen> case classes are currently fairly broken and useless and we are going to remove the existing implementation as soon as one of us writes up an RFC. the idea would be that "yes this is a feature we want" but we need to do a new RFC that writes up how they will work, explore edge cases etc.
<jemc> jwashton: up until fairly recently `match` clauses would always assume an `else None`, which is frustrating for the reasons you describe
<jemc> we recently implemented "exhaustive match checking" to the compiler, which makes it so that the compiler can detect when a match is exhaustive, and avoid adding the `| None` to the return type
<Jwashton> SeanTAllen: Specifically Case Functions as described in the tutorial. https://tutorial.ponylang.org/pattern-matching/case-functions.html I don't think I know what a "Case Class" would be. That's kind of a mind-blowing thought.
<jemc> the issue is that this feature could not be implemented for "case functions" in any sane way
<SeanTAllen> jwashton: yes that is what is going away. my advice. don't use them, you'll problem just get caused pain.
<Jwashton> jemc: That sounds exactly like what I was hoping for. That would avoid the awkwardness of either wrapping the call in another match or making the calling function a partial function.
<Jwashton> Aw... That's too bad.
<jemc> that fact, along with other edge cases that case functions don't handle correctly, are why we are hoping to get rid of them soon (and eventually replace them with a redesigned feature that works better)
codec1 has joined #ponylang
<jemc> for now, we are unofficially recommending that people avoid "case functions" and use explicit match statements
<Jwashton> I like the sound of "works better." The FizzBuzz solution presented there is basically the same one I would expect to see from Elixir, and it's still my favorite solution to the problem.
<SeanTAllen> its very nice
<SeanTAllen> i love the idea
<SeanTAllen> i want it in the language
<jemc> that recommendation will become official as soon as that RFC sean was talking about is written up
<SeanTAllen> the existing implementation has problems
<jemc> at which point we'll also remove them from the tutorial
<Jwashton> Roger that. I'll avoid them then. Thank you for the insight!
<jemc> the good news is that the same solution is still possible because anything that case functions do can also be done with looser argument types and explicit match statements
<jemc> that is, they were only syntax sugar for match statements (which is part of why they had problems)
<SeanTAllen> i dont know if jemc remember but when i first started using Pony a lot of my issues were my trying to use case functions.
<SeanTAllen> because I really love them.
khan has quit [Quit: khan]
khan has joined #ponylang
khan_ has joined #ponylang
khan has quit [Ping timeout: 248 seconds]
khan_ is now known as khan
<jemc> I think they had been recently added at the time you started using them too
emgonam2 has joined #ponylang
<Jwashton> jemc: Thanks for pointing that out. This is still pretty nice. https://playground.ponylang.org/?gist=ee82367792fe93fe6402546eccd0fc91
<winksaville> @dipin, I've added support for default_openssl to "Support OpenSSL 1.1.0" #2415 (https://github.com/ponylang/ponyc/pull/2415) I'd like you to take a look when you have a chance.
<winksaville> To be able to override the default_openssl setting I added "remove_build_flags" to buildflagset. Maybe there is a better, way but this is working for me.
dipin has quit [Quit: dipin]
Jwashton has quit [Remote host closed the connection]
<winksaville> @SeanTAllen, circleci seems to be working pretty well and travis is behaving poorly, my openssl pr 2415 timeout on llvm.org, should 3.9.1 tests be moved to circileci?
khan_ has joined #ponylang
khan has quit [Ping timeout: 265 seconds]
khan_ is now known as khan
Jwashton has joined #ponylang
<SeanTAllen> @winksaville im planning on moving more at some point.
<SeanTAllen> its a matter of having time
<jemc> jwashton: yeah, I'd even argue that your example is even cleaner!
gokr has joined #ponylang
gokr has left #ponylang [#ponylang]
Jwashton has quit [Remote host closed the connection]
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
Jwashton has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
winksaville has quit [Ping timeout: 260 seconds]
emgonam2 has quit [Ping timeout: 248 seconds]
<dave24> how do I compare two `Number`s for equality?
<dave24> I get errors about subtypes
jmiven has quit [Quit: co'o]
Jwashton has quit []
khan has quit [Quit: khan]
khan has joined #ponylang
jmiven has joined #ponylang
khan has quit [Client Quit]
gokr has joined #ponylang
mahmudov has quit [Quit: Leaving]
mahmudov has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
jnyw has joined #ponylang
winksaville has joined #ponylang
<winksaville> @SeanTAllen, to help out I thought I'd tried to create the llvm-3.9.1 docker image, but it failed trying to get llvm
<winksaville> I then logged on to llmv at oftc.net and asked if there were any mirror servers for llvm.
<winksaville> There doesn't appear to be any and they said releases.llmv.org is getting 150 requests/sec
<SeanTAllen> dave24: can you use the pony playground and put an example of what you are trying to do and put a link in here?
<winksaville> They really don't want CI systems pounding on their servers.
<SeanTAllen> so dave24, number isn't an interface. Its a union type. Which means you can't compare them like that. Number is type Number is (Int | Float).
<SeanTAllen> what exactly are you looking to do? Why are you storing those specific types as Number(s)?
<dave24> SeanTAllen: hm, I just wanted to compare numbers generically without caring what specific type they are. No big deal, I found a way around it by making sure they are always in the smallest possible type and then using `is`.
<jemc> I don't know the full context of what you're doing, but I'd just give a generic warning that comparing numbers without knowing their types means you lose some important information relating to their signed-ness and bounds, etc
<jemc> so it might be inviting usage bugs
<jemc> or it might be totally fine if you're doing it for a reason that justifies the obfuscation :)
<winksaville> @jemc, actually I ran into kinda that problem in message-ubench, currently OptionSpec doesn't support u64.
<winksaville> I add and OptionSpec.i64("report-count", ...)
<dave24> I have a hash function (which needs eq) that has to take any `Number` and a bunch of other stuff and I wanted to avoid writing out every single numeric type in my match expression.
<winksaville> But needed/wanted the variable to be u64 so I had to:
<winksaville> let report_count = cmd.option("report-count").i64().u64()
<winksaville> That feels wrong, but wasn't sure what else to do, any suggestions?
kai3x5 has quit [Ping timeout: 260 seconds]
kai3x5 has joined #ponylang
DDR has quit [Ping timeout: 240 seconds]
user10032 has quit [Quit: Leaving]
Schwarzbaer has quit [Ping timeout: 240 seconds]
DDR has joined #ponylang
Schwarzbaer has joined #ponylang
<jemc> winksaville: adding `u64` option support to the cli package seems reasonable to me
<winksaville> sg, I'll look into doing that
<jemc> dave24: are you using the standard `HashFunction[A]` interface from the `collections` package, where it is generic, type/paramaterized on the type being compared?
<jemc> if so, I think I can show you a better way to do it with less runtime uncertainty, if you paste what you have so far in a gist or playground link
<SeanTAllen> jemc winksaville: i dont think there are any u* methods for cli all are i*
<jemc> SeanTAllen: I think there is only I64 in terms of integer options
<jemc> `(None | String | I64 | F64)`
codec1 has quit [Read error: Connection reset by peer]
dipin has joined #ponylang
<SeanTAllen> ya
<SeanTAllen> that came over options
<SeanTAllen> not sure why
jemc has quit [Ping timeout: 268 seconds]
mahmudov has quit [Ping timeout: 276 seconds]