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
samuell has quit [Remote host closed the connection]
obadz has quit [Ping timeout: 246 seconds]
obadz has joined #ponylang
<hamstah> hi, I have 2 primitives, say A and B and a type (A | B). I'm trying to parse a string into that type. I tried match x| "a" => A "b" => B end. This does not work as the result of match is (A | B | None), so I can't pass the result to a function expecting (A | B).
<hamstah> is there a cleaner way to parse string -> type, or is there a way for me to tell the compiler that the value can't be none in the function call? I tried using error in the then clause, or adding an explicit if to ensure the value isn't none, but that doesn't seem to be enough to hint the compiler
<hamstah> thanks!
<achambers> I am really new to pony
<achambers> but do you mean else clause
<hamstah> yes sorry
<hamstah> I tried putting the match in a try block and error in the else. I was hoping the compiler would see that it can't get a None, but it didn't seem to work
<achambers> can't you declare the result with the specific type.
<achambers> result: (A | B)
<achambers> then assign that from the match
<hamstah> so in the match doing "a" => result = A
<hamstah> ?
<achambers> just a guess
<achambers> yeah
<hamstah> instead of result = match x
<achambers> there might be a way to do it your way though
<achambers> hopefulyl someone else will answer
<achambers> Im curious too
<hamstah> I can try, but your version sounds closer to what case is used for no?
<hamstah> for reference one of the things I tried
<hamstah> the compiler should be able to see that this can't return None
<achambers> does matching _ instead of else do anything?
<hamstah> you'd have to give it a value after => right?
<hamstah> in that case it's equivalent
<hamstah> best thing you can do is => None
<achambers> error?
<achambers> i was just wondering fi the compiler treats them differently
<hamstah> ah
<hamstah> I see
<hamstah> I don't think that would change anything
<hamstah> I think I might be missing something about types/match in general
<hamstah> or a better pattern for what I'm trying to do
<hamstah> I have about 1h pony experience :D
<achambers> haha, I have about 2 hours of writing, and lots of reading
<hamstah> one-eyed leading the blind :D
<hamstah> I think your initial suggestion, declaring the variable first won't work. What do you initialise the value to?
_whitelogger has joined #ponylang
<SeanTAllen> hamstah: is that the code that isnt working for you above?
<SeanTAllen> so you have a couple of strings out of all the possible strings
<SeanTAllen> and if you get one of those, then its a certain type, yes?
<SeanTAllen> the compiler isnt going to let you get away with that with the else
<SeanTAllen> because there a so many other possibilities
<SeanTAllen> your match has to exhaustive or you need an else
<SeanTAllen> stepping back for a moment, why are you going from a string to a type?
<hamstah> that's the real question actually.
<hamstah> I'm getting strings from an http request
<hamstah> then I build an object with a primitive
<hamstah> instead of the string
<SeanTAllen> why?
<hamstah> wanted to use an enum I guess
<SeanTAllen> because it will give you more type safety the rest for the rest of the request?
<hamstah> so I know it's either A or B later on, not just an possible string
<SeanTAllen> right
<SeanTAllen> that's reasonable
<SeanTAllen> so
<SeanTAllen> the compiler is doing the right thing
<SeanTAllen> you have to handle the "not 'a' or 'b'" issue
<SeanTAllen> so, questions:
<hamstah> in my case I just want to error
<SeanTAllen> do you care about performance?
<hamstah> reasonably
<SeanTAllen> like if you could only do 30k/40k requests a second would that be fine?
<hamstah> for now yes
<SeanTAllen> go with error
<SeanTAllen> have it error in the else
<hamstah> yeah
<hamstah> that's what I have now
<SeanTAllen> that's what you need then
<SeanTAllen> also
<SeanTAllen> welcome hamstah
<hamstah> :)
<hamstah> thanks
<SeanTAllen> sometimes this channel is a little slow
<SeanTAllen> especially on weekends
<hamstah> no worries, I'm in no rush :)
<SeanTAllen> so i would suggest also availing yourself of the mailing list if you cant get answers here
<hamstah> appreciate your help
<SeanTAllen> also in the welcome message for the channel
<SeanTAllen> there was a link tot he irc logs
<hamstah> yes
<SeanTAllen> we do answer questions even after you have left
<SeanTAllen> so do check the logs if you come, ask and have to leave
<hamstah> cool. I have a bouncer anyway
<SeanTAllen> achambers: nice work with helping! you'll be a seasoned Pony pro before you know it
<hamstah> hehe
<hamstah> while I got you, I was struggling to get the body of my http request to be parsed as json. using request.has_body() returns false when query with curl -d or -f
<hamstah> am I missing something?
<SeanTAllen> let me go look at the curl manpage
<SeanTAllen> im not particularly familiar with it
<hamstah> I saw the issue on github with someone trying something similar, but ti seems I'm just not getting chunks. I'm using the http server example
<hamstah> -d sends a raw body, -f form encoding I think
<SeanTAllen> mine says -f is "fail"
<hamstah> -F sorry
<SeanTAllen> and -d is is a post request
<hamstah> -F is form
<hamstah> -d is data
<SeanTAllen> i haven't used the HTTP server other than to look at what the performance problems are that need to be solved
<hamstah> ok cool, no worries then I'll dig a bit more
<SeanTAllen> it was written by a community member, so I'm afraid i'm not much help
<SeanTAllen> if i have time outside of work, i might start working on a high perf http parser and work my way out from there
<SeanTAllen> otoh, i dont have a lot of free time as is between current pony load and work
<hamstah> yeah I saw the comment on the github issue about pef
<SeanTAllen> that server was definitely not written with performance in mind
<SeanTAllen> if you get an itch to write a high-perf one
<hamstah> hehe
<hamstah> might get there
<SeanTAllen> there's now a guide i wrote for writing high perf pony on the website
<SeanTAllen> and i'm happy to help
<hamstah> yes
<SeanTAllen> help meaning, give tips, pointers etc
<hamstah> when I get more familiar with the language
<SeanTAllen> those of us at Sendence probably have more experience than anyone else in making Pony go really fast
<hamstah> I'm early super early stages right now, but later on sure
<SeanTAllen> ya i know
<SeanTAllen> dont worry about it
<hamstah> you probably also have the most experience with large scale projects I guess?
<hamstah> (in pony)
<SeanTAllen> probably
<hamstah> at some point I will have tons of questions about persistence of actors queues and crash recovery but let me play w bit with the basics first
<SeanTAllen> well: there's no persistence of actor queues
<hamstah> comparing a bit to elixir/erlang
<SeanTAllen> big differences: type system. better performance characteristics are possible. erlang is much much much much much more mature.
<hamstah> yeah
<hamstah> obviously
<SeanTAllen> erlang has distributed erlang. at this point there's a plan for distributed pony but its not high on the list of things to do.
<hamstah> yeah I've seen mentions
<SeanTAllen> we are a volunteer project so in the end, what gets done is what people have as an itch
<SeanTAllen> sylvan and i have talked and we both think that things like language server support and other tooling are more important in our minds
<hamstah> makes sense
<hamstah> do you know if he ever published the code for the talk he gave last year on fintech with pony?
<hamstah> the example trading system
<hamstah> I'm writing a toy version of that as my tutorial
<hamstah> order book management etc
<SeanTAllen> not that i am aware of
<SeanTAllen> i know a couple people who have done their own in a day or two
<SeanTAllen> its a fairly good learning experience writing one
<hamstah> yeah
<hamstah> and then find a way to make the orders persistent :D
<SeanTAllen> we are opening up the source of Wallaroo in a month
<SeanTAllen> once we add dynamic keys, you would probably be able to do what you want with it and we do persistence of state changes
<SeanTAllen> message handling etc
<SeanTAllen> as long as you can turn your order book into a streaming job
<SeanTAllen> which you probably can depending on the design
<hamstah> yeah I saw the announcement about wallaroo, looking forward to it
<SeanTAllen> you can use it with pony
<SeanTAllen> but we arent officially supporting pony
<SeanTAllen> that said, you could certainly use it
<hamstah> out of curiousity, why are you open sourcing it?
<hamstah> make money from services instead of the code itself?
<SeanTAllen> we arent making a service play
<SeanTAllen> we are opening up the code for everything
<SeanTAllen> however only a subset of features is "open source"
<SeanTAllen> the stream processing core and resilient state is apache 2
<SeanTAllen> everything else is under a commercial license that would allow you to run
<SeanTAllen> stream processing core, resilient state on up to 3 machines/48 cpus.
<hamstah> cool
<SeanTAllen> and other features like exactly-once message processing, and some others are $
<SeanTAllen> but
<SeanTAllen> its free to use everything if you arent in production
<hamstah> so you can prototype for a bit
<SeanTAllen> in production, you have the core apache 2 functionality + limited clustering
<hamstah> as long as I can ditch flink and java/scala
<SeanTAllen> sorry, i mispoke, basic state handling is part of apache 2.
<SeanTAllen> the resilience bit, that is commercial initially
<hamstah> ok
<SeanTAllen> we are being very conservative about what we make available for free initially
<SeanTAllen> we very much want people to be able to use it
<SeanTAllen> try it out
<SeanTAllen> find a use case that is worth paying us
<SeanTAllen> or just get feedback and build a better product
<SeanTAllen> we are a young company and have a long long list of things to implement but we have a solid core to build on
<hamstah> sounds good. I will give it a try, I have a few things in mind that could benefit from it
theodus has quit [Quit: theodus]
coopernurse has quit [Ping timeout: 240 seconds]
Bombe has quit [Ping timeout: 240 seconds]
coopernurse has joined #ponylang
Bombe has joined #ponylang
tscho has quit [Ping timeout: 240 seconds]
tscho has joined #ponylang
tscho_ has joined #ponylang
tscho has quit [Ping timeout: 248 seconds]
_whitelogger has joined #ponylang
_whitelogger has joined #ponylang
_whitelogger has joined #ponylang
_whitelogger has joined #ponylang
mrkishi has joined #ponylang
Georgeal has joined #ponylang
mrkishi has quit [Ping timeout: 240 seconds]
Georgeal has quit [Ping timeout: 260 seconds]
plietar has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
mrkishi has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
* doublec steps away from the keyboard after sending the nth pony-user mailing list post correcting/following up his previous.
<doublec> It's always immediately after hitting send you realise a mistake
<achambers> are there any database driver libraries for pony around?
<SeanTAllen> there were a couple projects a while ago
<SeanTAllen> i dont know the quality or if they are up to date
<achambers> my current method is just to do a github wide search to find all pony libraries
<achambers> ah cool, that sqlite one looks interesting
samuell has joined #ponylang
<achambers> interesting how the C bindings make the api's synchronous
plietar has joined #ponylang
<doublec> With regards to performance, is it the try...end that has overhead or is it calling partial functions?
theodus has joined #ponylang
<SeanTAllen> try has no overhead, calling partial functions has no overhead
<SeanTAllen> unwinding the stack if you `error` has a cost
<doublec> ok, thanks
theodus has quit [Client Quit]
<SeanTAllen> thus the "if this basically never happens `error` is good for performance"
<SeanTAllen> because if you use a union type, thats a branch for every single call
theodus has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
theodus has quit [Remote host closed the connection]
plietar has quit [Ping timeout: 240 seconds]
vaninwagen has joined #ponylang
theodus has joined #ponylang
vaninwagen has quit [Ping timeout: 240 seconds]
theodus has quit [Remote host closed the connection]
Praetonus has joined #ponylang
TheNet has joined #ponylang
samuell has quit [Quit: Leaving]
endformationage has joined #ponylang
theodus has joined #ponylang
Matthias247 has joined #ponylang
vaninwagen has joined #ponylang
coopernurse has quit [Quit: Leaving]
vaninwagen_ has joined #ponylang
vaninwagen has quit [Ping timeout: 240 seconds]
vaninwagen_ has quit [Quit: Ex-Chat]
vaninwagen has joined #ponylang
TheNet has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TheNet has joined #ponylang
TheNet has quit [Client Quit]
<vaninwagen> whoa, the playpen caches outputs of programs with the same source without re-running them! *mind-blown* for a leap-second i thought random was broken. o_O
<endformationage> vaninwagen: Ah, I noticed that the other day and forgot to mention.
<endformationage> I think I was playing with random too.
<vaninwagen> i did: let rnd = Rand(Time.millis()) and output was still the same :)
<jmiven> vaninwagen: Time.millis() always return the same value in the playground https://is.gd/ODoaFk
<vaninwagen> jmiven, yes, output of programs seems to be cached. it changes if you change just 1 char in your program.
<vaninwagen> jmiven, this one: https://is.gd/X9K4lO gives 12018255420 for me, yours 12017837214
<jmiven> vaninwagen: oh indeed. Sorry :-)
<vaninwagen> cache key might be a source-code-hash
TheNet has joined #ponylang
vaninwagen has quit [Ping timeout: 240 seconds]
TheNet has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TheNet has joined #ponylang
TheNet has quit [Client Quit]
jmiven has quit [Quit: co'o]
jmiven has joined #ponylang
endformationage has quit [Quit: WeeChat 1.9]
Matthias247 has quit [Read error: Connection reset by peer]
plietar has joined #ponylang
<achambers> Could I make a suggestion for the pony homepage, I think the download links could be on the front page.
<achambers> right now finding the platform download is about 5-6 clicks from the front page.
plietar_ has joined #ponylang
plietar has quit [Read error: Connection reset by peer]
mrkishi has quit [Ping timeout: 248 seconds]
<SeanTAllen> You can achambers put its unlikely to happen at this point in time. There's a lot of information about how to install and the decision was made to keep it in the README of the repo. It used to exist in more than one place and it got out of whack. I need to spend some time now on the homepage but the goal is to direct people to the section of the website that would interest them so, for folks who want download that
<SeanTAllen> is really about "you want to get started? great, go to the learn section".