-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of Try-XYZ pattern #277
base: main
Are you sure you want to change the base?
Conversation
The main issue now is how to suport Try pattern and async. Currently using a tuple return value
I'm not super happy with this, particularly with the TryRead and TryReadAsync methods. e.g. bool TryRead(out object value);
Task<bool> TryReadAsync(out object value); The sync version is valid C#, but the async version is not. You can't have out parameters on async methods. Another option would be to not return the value at all, but then the API would be different to the We could convert the |
Thinking about it now (after a long walk), not returning the values is probably less jarring for an API consumer than returning a tuple. |
I'm still skeptical of the 'try' pattern. That said I've also never quite liked that Read doesn't return a value... We discussed that at some point. Maybe we should do a call and go through the API holistically? Design an ideal state and aim for a 2.0 version? |
…ask<bool> instead of the tuple with that and the Value.
That sounds good @jkoplo |
Let me know if there are changes that would be needed in the core library. I think it may be about time to rethink the core API as well though I have not had any flashes of insight into how it might be better. All the other libraries expose the PLC as the base object and some do not have tag objects at all, they just use strings or register numbers. |
@kyle-github not about the core library per se, but we do get a lot of repeat questions. What do you think about something like an FAQ? |
That sounds like a good idea. Can you edit the wiki on the main project? If not, I can start a FAQ page. One challenge here is that it seems like most of the users are using the C# wrapper. I don't get that many using the core C library anymore. |
FAQ: There are definitely some things that belong in the main repo docs/faq and some things that are probably c# specific. How cheesy would it be for the c# wiki to link to the main wiki on certain topics? Also, I'm using DocFX in my real job for a few things. If I can carve out some time, I'd love to get that spun up on libplctag.net and maybe host it in a github.io site. I just checked the nuget stats and the native wrapper has almost 40k downloads. That's pretty legit. |
I don't have a problem with FAQs referencing other FAQs. 40k downloads is great! I am not sure I can get statistics for downloads of the core library out of GitHub without paying for a premium account. |
No description provided.