<SeanTAllen>
We don't have exhaustive match so, the None is a result of that. Exhaustive match is an open issue that needs to be addressed. It sounds like you've found a bug. `with` isn't widely used so it doesn't surprise me. I think you should open an issue for this aav and we can discuss at the sync. Sounds like a bug to me.
<SeanTAllen>
but, i could be wrong
<jemc>
as SeanTAllen says, `with` isn't widely used (I've actually never used it myself)
<jemc>
but I think it's acting like a `try` block here, in that it expects that an `error` is possible within the block, so unless you provide an `else` block, the implicit `else` block is simply `else None`
<jemc>
I agree with SeanTAllen that it needs discussing on the sync call - particularly, the "try expression never results in an error" message you see
<aav>
so, the bottom line is - avoid using 'with'?
<aav>
but what is the idiomatic way to ensure that resource (i.e. file) is closed under any condition?
<SeanTAllen>
aav i wouldnt say that, im saying you might encounter some issues that need to get fixed. at the moment, i think you might be blocked. `with` would be idiomatic but i don't think its used much because people would normally have the resource exist for the lifetime of an actor in which case `with` doesn't ever get used.
<jemc>
aav: well, arguably `with` was created to be the idiomatic way to do that, though because in practice it doesn't get a lot of use, it may be rough around the edges
<SeanTAllen>
yes, what jemc said, better than i
<jemc>
was about to say that you said it better :P
<SeanTAllen>
ha
<SeanTAllen>
agree to disagree on who said it better
<jemc>
aav: the `files` package is probably the most common usage of the `with` block - I think that's probably because the `dispose` idiom is mostly used among actors, and `with` is only really useful for disposable synchronous objects
<jemc>
I don't know of other synchronous APIs that use `dispose` other than the `files` package, though it seems like a nice idiom for the rare cases where you want to explicitly dispose a synchronous object
TonyLo has quit [Ping timeout: 256 seconds]
TonyLo has joined #ponylang
<TonyLo>
Is there a way to get a hash of an actor? I want to create a HashSet of Actors
<jemc>
TonyLo: have you seen the ``HashIs` hash function in `collections/hashable.pony`?
<TonyLo>
looking now, thx
<jemc>
I think what you want to use is `SetIs` for your set
<jemc>
`SetIs[MyActorInterface] is probably what you want
_andre has quit [Quit: leaving]
<TonyLo>
yes, this looks good thx
<jemc>
since `SetIs` is defined as a `HashSet` using the `HashIs` function
<jemc>
`type SetIs[A] is HashSet[A, HashIs[A!]]`
<jemc>
incidentally, this is pretty much the only useful use of the `digestof` operator, which returns a number that can be used to "uniquely" identify an object instance
<jemc>
mainly because there are some edge cases where the `identity` isn't totally unique
<jemc>
the uniqueness problems really only start popping up when you get the "identity" of an object to a number, or some other uncommon cases like that
<TonyLo>
ok, thx for the value add :)
TwoNotes has joined #ponylang
<TwoNotes>
Is there a way to put a MD link syntax into a Pony comment so that it will turn up as an HTML link in the generated stdlib documentation?
<TwoNotes>
I am writing the package-level documentation, and I want to provide links to the key interfaces.
<jemc>
TwoNotes: I think you should be able to do something like `[MyType](my_package-MyType)`
<TwoNotes>
I will try that and see how mkdocs transforms it.
<TwoNotes>
Is the package name 'net/http' or just 'http'?
<jemc>
TwoNotes: you can see the correct "fully qualified type name" in the last segment of the URL when you have the page for that type up in your browser
<dougmacdoug>
noob here, has there been any consideration to relax the naming restrictions to allow underscore in class names? Easy_To_Read
<aav>
FilePath.create() is declared as partial, OpenFile.apply() returns (File | FileErrNo). when is it idiomatic to make function partial, and when to return some error status?
<aav>
like in the example above?
Matthias247 has quit [Read error: Connection reset by peer]
<jemc>
aav: in general, it's idiomatic to use a partial function when there is only one reason why an error occurred - there's no ambiguity in the error, and the docs should indicate what the error (always) means
<jemc>
for example, the docs for `Array.apply` say: "Get the i-th element, raising an error if the index is out of bounds."
<jemc>
so if you get an error, you know exactly what it means (index out of bounds)
<jemc>
this is the preferred idiom wherever possible, because it keeps things quite simple
<jemc>
however, sometimes you do need to convey some information, so another idiom is appropriate
<jemc>
returning a type union where one type indicates success, and others different kinds of failure is one idiom for that
<jemc>
another idiom would be accepting a notifier object or lambda that will be called when an error occurs, passing any necessary value(s) as arguments to the call
<jemc>
this idiom is common on asynchronous objects, but could also be used synchronously
<jemc>
there is also an outstanding proposal to add another error handling mechanism to the language, though it still has some outstanding concerns: https://github.com/ponylang/rfcs/pull/76
aav has quit [Ping timeout: 240 seconds]
seanohue has joined #ponylang
<SeanTAllen>
dougmacdoug: No. There hasn't been any consideration of that.
<dougmacdoug>
I use CamelCase in java and c# on a regular basis, but I have gotten used to using Snake_Case on other compiled languages and I just find the latter so much easier to read
<jemc>
I'm not totally sure, but I believe there were some technical restrictions (related to name munging) that prevent using underscores in type names
<jemc>
if those technical restrictions could be cleared (or if they don't actually exist), I personally would be in favor of allowing underscores in type names
<jemc>
I think CamelCase is most appropriate as a convention, but I've sometimes wished for being able to do things like MyCategory_MyType for better organizing type names in some cases
<jemc>
or MY_CONSTANT_NAME for types that are "emulating" constants
aav has joined #ponylang
<aav>
jemc: thank you, hope i'm not too annoying with such questions
<jemc>
nope, not annoying at all - always happy to answer questions :)
<aav>
jemc: like with any new language i'm trying to get the feeling of what is the right way to do things
rurban has joined #ponylang
<jemc>
definitely
<aav>
jemc: when i look at FilePath.create i can see, that it raises error in three distinct conditions -
<jemc>
and in some cases, so are we ;)
<aav>
1 - missing capability, 2 - empty path, 3 - 'else' case in the match (actually it will never be reached)
<jemc>
aav: looking at the code, actually, the second condition is more like: "absolute path was given, and didn't use AmbientAuth"
<jemc>
docs for `Path.join` says it will return the path unchanged if it is absolute
rurban has left #ponylang [#ponylang]
<jemc>
so the check for `path.at(b.path, 0)` is used to check if the root path is indeed at the root (index 0) of the new path
<jemc>
so if that check fails, it means the user gave an absolute path
<jemc>
so, other than the unreachable error, the possible errors could be summarized as "insufficient permissions to access that path"
<aav>
jemc: i see
<TwoNotes>
WHat is the procedure for submitting a pull request to ponyc-master?
<jemc>
replace each instance of the word `pick` with `squash`
<jemc>
then save the file
<TwoNotes>
EACH occuerance? It says squash all but the first
<TwoNotes>
I have 5 commits. pick, then 4 squashes?
<jemc>
sorry, yes, `pick` the first one
<jemc>
or `edit` if you want to change the message
<jemc>
also, squashing is preferred, but we can also squash-on-merge if squashing ahead of time is too much of a burden for the contributor
<TwoNotes>
I put the word "edit" in place of "pick"?
<jemc>
yes
<TwoNotes>
So 'edit', then 4 squashes, exit
<jemc>
sorry, forgot about `reword` - you should use `reword` instead of `edit` if you only want to change the commit message, and not the content
<TwoNotes>
Ok I think I got it
<TwoNotes>
git log shows only the one commit now
<TwoNotes>
But git branch shows me on a (no branch, rabasing) line
<jemc>
`git rebase --continue` is what you need I think
<TwoNotes>
Now I lost it. I have to start over. Luckily I saved the whole repo fist
<jemc>
sorry
<jemc>
as I mentioned, if it's too much burden, feel free to push it up as-is, and we can squash on merge
<jemc>
I don't want contributors being frustrated by procedure, when we have a workaround we can use
<jemc>
aav: I can say it doesn't look very pleasant to me, but it's not your fault
<jemc>
we were having a discussion just this week about not being totally happy with how the File API handles errors
<jemc>
I think your gist is a good example of something that should be much easier and prettier than it is, highlighting a need for making the File API better
aav_ has joined #ponylang
adamkittelson_ has joined #ponylang
jtfmumm__ has joined #ponylang
gornikm_ has joined #ponylang
omarkj_ has joined #ponylang
darach_ has joined #ponylang
SparkySparkyBoom has joined #ponylang
<aav_>
jemc: yep
<aav_>
and exhaustive pattern matching would also help a lot