CentreForDigitalHumanities / tscan

T-scan: an analysis tool for dutch texts to assess the complexity of the text, based on original work by Rogier Kraf
GNU Affero General Public License v3.0
18 stars 6 forks source link

Typing of sentStats::sv should ideally be a wordStats instead of a basicStats #62

Open oktaal opened 2 years ago

oktaal commented 2 years ago

See:

https://github.com/UUDigitalHumanitieslab/tscan/pull/61#discussion_r990038148

The problem is that struct basicStats (which is the base for wordStats) contains the definition:

https://github.com/UUDigitalHumanitieslab/tscan/blob/bec422ccb74a3c88ef329dfbc0b925021d0bf8fa/include/tscan/stats.h#L107

This makes it harder to introduce generic type because this would introduce a circular type dependency e.g.:

typename T
struct basicStats {
  ...
  std::vector<T*> sv;
}

struct wordStats: public basicStats<basicStats<...?>> {
  ...
}
jgonggrijp commented 2 years ago

If sv must be polymorphic in some cases, then it could be a problem, although you could list the permitted types using std::variant instead of using basicStats (or structStats) as a wildcard.

It's hard to tell from the code immediately. Are there cases where sv should be polymorphic?