<commit_before>* Why?
- alternative: Dates as first column of DataFrame
- Problems:
  - mean(df) 
    - has to be adjusted for first column: mean(df[:, 2:end])

  - overload plot methods
  - models will return simulated data without dates
    - evaluating portfolio returns should be robust to both real data
      with dates and simulated data without dates
    - any(isna(df[:, 2:end]))

* Behaviour 
As DataFrame most likely will become the most important type in data
analysis, Timedata types should behave as similar to DataFrames as
possible. Hence, behaviour should be inherited with only few
exceptions. 

* Inheritance
In object oriented programming, this is possible through
classes: subclasses will automatically inherit the behaviour of
superclasses. 

This kind of inheritance can easily be emulated in Julia through
types, although composite types generally are not allowed to be
supertypes (only abstract types have subtypes). One simply needs to
define a new composite type which owns a field of the respective
"supertype", and delegate all functionality that should be inherited
to this field. 

#+BEGIN_SRC julia
f(myType) = f(myType.superclass)
#+END_SRC

However, looking at delegation in more detail, one needs to
distinguish between two types of methods:
- type preserving methods
- non-preserving methods

** Non-preserving methods
#+BEGIN_SRC julia
   f(myType) = f(myType.superclass)
#+END_SRC

** Type preserving methods
#+BEGIN_SRC julia
   function f(myType)
       superclassResult = f(myType.superclass)
       return myType(superclassResult)
   end
#+END_SRC

* Inheritance<commit_msg>behavior inheritance outsourced to separate blog entry<commit_after>* Why?
- alternative: Dates as first column of DataFrame
- Problems:
  - mean(df) 
    - has to be adjusted for first column: mean(df[:, 2:end])

  - overload plot methods
  - models will return simulated data without dates
    - evaluating portfolio returns should be robust to both real data
      with dates and simulated data without dates
    - any(isna(df[:, 2:end]))

* Behaviour 
As DataFrame most likely will become the most important type in data
analysis, Timedata types should behave as similar to DataFrames as
possible. Hence, behaviour should be inherited with only few
exceptions. 

* Inheritance
In object oriented programming, this is possible through
classes: subclasses will automatically inherit the behaviour of
superclasses. 

This kind of inheritance can easily be emulated in Julia through
types, although composite types generally are not allowed to be
supertypes (only abstract types have subtypes). One simply needs to
define a new composite type which owns a field of the respective
"supertype", and delegate all functionality that should be inherited
to this field. 

#+BEGIN_SRC julia
f(myType) = f(myType.superclass)
#+END_SRC

However, looking at delegation in more detail, one needs to
distinguish between two types of methods:
- type preserving methods
- non-preserving methods

** Non-preserving methods
#+BEGIN_SRC julia
   f(myType) = f(myType.superclass)
#+END_SRC

** Type preserving methods
#+BEGIN_SRC julia
   function f(myType)
       superclassResult = f(myType.superclass)
       return myType(superclassResult)
   end
#+END_SRC

{'fraction_non_alphanumeric': 0.05799324946302547, 'fraction_numerical': 0.00122737035900583, 'mean_word_length': 4.3884297520661155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1936404', 'n_tokens_mistral': 909, 'n_tokens_neox': 852, 'n_words': 408}