question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Single type argument version of Tag

See original GitHub issue

The current API provides two versions of Tag.

  • Tag
  • Tag<M,T>

This issue suggests that we add a third type that takes a guess at which Mapper class to use based on a single type argument for the CLR type to use. i.e. Tag<T>

Some discussions where this was discussed:

What needs to be decided?

  • What should the mappings be between CLR type and Mapper types.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jkoplocommented, Mar 11, 2021

I took a quick spin through it, but your other comment jogged my memory.

If we only specify the CLR type, how do we know what the PLC type is to create the tag? (Since they aren’t 1-to-1). Or can we actually get by without knowing that?

Other than that, in terms of implementation I was thinking of using a dictionary or even a factory-pattern to get the mapper. That has the benefit of getting the case structure out of the class and allowing for runtime changes (adding custom mappers) with the trade-off of increased complexity. If we didn’t want to DI the lookup, then we’d have to make it a static. That being said, defining it in code is more or less a static anyway.

The other route would be to go toward an actual factory-pattern for tags. I end up implementing that in my local code anyway. Create a TagFactory and set PLC path/params/etc and then just use it to instantiate tags with a Type and Name. Each factory instance could hold an instance of the lookup that it uses to DI. At that point, we could just pass the proper mapper to the Tag and take that concern away from the Tag class. Thoughts?

0reactions
TheFern2commented, Dec 11, 2022

@jkoplo how do you call function to create tag, read write value from another class?

Please don’t necro threads. This question has nothing to do with this discussion.

Post questions to libplctag forum or open another issue with your question. https://github.com/libplctag/libplctag#libplctag-forum

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow multiple tag arguments in selectors, like @a[tag=hi ...
So I propose that selector arguments evaluate their arguments using proper logical AND and not just lazy limitation of 1 argument type per ......
Read more >
Using a generic type argument in place of an ...
to non generic version (otherwise some arguments will be generic type arguments, and some will be regular arguments).
Read more >
Git - git-tag Documentation
Running "git tag" without arguments also lists all tags. ... Also supports "version:refname" or "v:refname" (tag names are treated as versions).
Read more >
Patch 2016 xparse to support k-type argument
If I have a single (patched) version of xparse that supports both argument types, the transition will be a lot easier.
Read more >
Recommended XML tags for C# documentation comments
This article provides the syntax and definitions for recommended tags for XML documentation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found