<slfritchie>
I've written my first PonyCheck test, and it works, hooray, and now I've extended it, and now I'm crashing the compiler that looks like bug #1864. What a day.
<SeanTAllen>
Which is 1864 Scott?
<slfritchie>
SeanTAllen: Compiler error with type #1864 .. `src/libponyc/type/cap.c:850: cap_view_upper: Assertion `0` failed.
<slfritchie>
` Not quite the same error that I see, but the `reify` and `reify_one` function appear both in #1864's and my stack traces
jemc has quit [Quit: WeeChat 1.9]
<SeanTAllen>
Doh
<SeanTAllen>
Seems like a thing that needs fixing then
<sjaustirni>
SeanTAllen thank you. I have provided `eq`: `fun box eq(that: box->Key): Bool val` but the function did not have the correct signature? (I copied it from here: https://stdlib.ponylang.org/builtin-Equatable/).
acarrico has quit [Ping timeout: 240 seconds]
patroclos has joined #ponylang
acarrico has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
sjaustirni has quit [Quit: Leaving]
endformationage has joined #ponylang
<SeanTAllen>
sorry, i need code for your problem to be able to help. can you provide a minimal example sjaustirni?
acarrico has quit [Ping timeout: 240 seconds]
acarrico has joined #ponylang
milisarge has quit [Ping timeout: 264 seconds]
milisarge has joined #ponylang
acarrico has quit [Ping timeout: 268 seconds]
sjaustirni has joined #ponylang
<sjaustirni>
SeanTAllen, it's in the code sample I posted earlier. https://is.gd/IR30ZM
sarna has joined #ponylang
<sarna>
what's the idiomatic way of handling errors in pony? with `error` I can't specify what the error is :(
<SeanTAllen>
sarna, Pony doesnt have typed exceptions
<SeanTAllen>
you only have "error"
<SeanTAllen>
the idea is that there should only be a single error that you are returning or it shouldn't matter
<SeanTAllen>
if you need to distinguish types, then you want to use a Union type like
<SeanTAllen>
(U64 | Error1 | Error2)
<SeanTAllen>
`error` is for "unable to compute"
<sarna>
or (U64 | Error) and then define Error as (Error1 | Error2) ?
<SeanTAllen>
No
<sarna>
hmm
<SeanTAllen>
(U64 | Error1 | Error2)
<sarna>
why is my approach wrong?
<SeanTAllen>
in order to handle any error, you are going to have to do more matches
<SeanTAllen>
you'll have to match on error
<SeanTAllen>
then you'll have to match on Error1 or Error2
<SeanTAllen>
thats potentially 3 or 4 matches
<SeanTAllen>
that its going to have to check
<sarna>
yeah, so I can chose if I care about what the error was or not
<SeanTAllen>
well, i supoose
<SeanTAllen>
what the point of the return type if you dont care
<SeanTAllen>
throw `error` and be done with it
<SeanTAllen>
put your code in a try...end without an else
<SeanTAllen>
or
<SeanTAllen>
if you dont care about error in your match
<SeanTAllen>
dont match on it
<sarna>
or return false, like some functions in the files package.. :/
<sarna>
in the files package, mkdir returns true or false lol
<SeanTAllen>
but its going to be more efficient to do (U64 | Error1 | Error2)
<sarna>
alright, I'm gonna use this approach
<SeanTAllen>
not sure what this approach is, but either way will work.
<SeanTAllen>
the more idiomatic pony way would be
<SeanTAllen>
(U64 | Error1 | Error2)
<SeanTAllen>
error handling in the file package needs to be reworked btw.
<sarna>
so, error is for unrecoverable stuff, did I get this right?
<SeanTAllen>
I wouldnt say "unrecoverable"
<SeanTAllen>
Depends on what you mean by "unrecoverable"
<sjaustirni>
I see, thank you SeanTAllen
<sarna>
"well that went horribly wrong" would be "unrecoverable" for me
<SeanTAllen>
you could use a union type for that as well
<SeanTAllen>
If you need to distinguish what went wrong
<sarna>
by the way, if my function is just side effects, would it be idiomatic for the return type to be `(Error1 | Error2)?` ? SeanTAllen
<sarna>
is ? for None or for error? I forgot, shucks
<SeanTAllen>
where there is more than 1 thing that you need to indicate went wrong, you need to use a union type
<sarna>
I see
<SeanTAllen>
If you only had side effects or a couple erorrs
<SeanTAllen>
then
<SeanTAllen>
(None | Error1 | Error2)
<sarna>
alright, thank you
<SeanTAllen>
if you could use either error or union type
<SeanTAllen>
you should pick based on API or performance
<SeanTAllen>
the performance cheat sheet discusses when to use error vs match
<SeanTAllen>
if you are concerned about performance
<sarna>
yup, I've seen that
<sarna>
nah, not with this project :)
<SeanTAllen>
one of the big reasons why the HTTP server thats about to be removed from the stdlib is slow is because it uses error for things flow control and things that happen all the time, in the hot path
<sarna>
ah
<sarna>
is it going to be just removed, or replaced?
<SeanTAllen>
removed
<SeanTAllen>
"let a thousand flowers bloom"
<SeanTAllen>
we'd rather see the community drive creation of different HTTP servers that meet different needs
<SeanTAllen>
it will still exist in a repo under ponylang
<SeanTAllen>
but it wont have the "official blessing" of being in the standard library
<sarna>
I see. nice
sjaustirni has quit [Quit: Leaving]
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
sarna has quit [Quit: Connection closed for inactivity]
Anon has joined #ponylang
Anon is now known as Guest98245
Guest98245 has quit [Quit: Page closed]
khan has quit [Quit: khan]
khan has joined #ponylang
acarrico has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
acarrico has quit [Ping timeout: 256 seconds]
acarrico has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
<patroclos>
so i've managed to get some partially complete, partially correct vscode completion going