<commit_before>#ifndef IMPL_AX_EVENTABLE_HPP
#define IMPL_AX_EVENTABLE_HPP

#include <cstddef>
#include <functional>
#include <unordered_map>
#include <memory>

#include "prelude.hpp"
#include "id.hpp"
#include "castable.hpp"
#include "address.hpp"
#include "addressable.hpp"
#include "subscription.hpp"

namespace ax
{
    template<typename P>
    using unsubscriber = std::function<void(P&)>;

    // A program mixin for enabling publisher-neutral events in a program. What is a program mixin?
    // Well, it's like any other C++ mixin, except it's intended for use on the type that end-user
    // will represent his program with. Program mixins are the good alternative to OOP Singletons.
    template<typename P>
    class eventable : public castable
    {
    public:

        CONSTRAINT(eventable);

        eventable() :
            pred_id(std::make_unique<id_t>())
        {
            CONSTRAIN(P, eventable);
            program = &ax::cast<P>(*this);
        }
<commit_msg>Fixed "events work" unit test.<commit_after>#ifndef IMPL_AX_EVENTABLE_HPP
#define IMPL_AX_EVENTABLE_HPP

#include <cstddef>
#include <functional>
#include <unordered_map>
#include <memory>

#include "prelude.hpp"
#include "id.hpp"
#include "castable.hpp"
#include "address.hpp"
#include "addressable.hpp"
#include "subscription.hpp"

namespace ax
{
    template<typename P>
    using unsubscriber = std::function<void(P&)>;

    // A program mixin for enabling publisher-neutral events in a program. What is a program mixin?
    // Well, it's like any other C++ mixin, except it's intended for use on the type that end-user
    // will represent his program with. Program mixins are the good alternative to OOP Singletons.
    template<typename P>
    class eventable : public castable
    {
    public:

        CONSTRAINT(eventable);

        eventable() :
            pred_id(std::make_unique<id_t>())
        {
            CONSTRAIN(P, eventable);
            program = dynamic_cast<P*>(this);
        }

{'fraction_non_alphanumeric': 0.1062124248496994, 'fraction_numerical': 0.0, 'mean_word_length': 3.3038793103448274, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '1659028', 'n_tokens_mistral': 637, 'n_tokens_neox': 616, 'n_words': 186}