Please create a system that fulfills all of the following requirements:
  1. The system must make decisions based on a series of rules.
  2. These rules must be changeable on the fly.
  3. The set of acceptable rule formats must be changeable on the fly. In other words, a new type of rule must be addable during run-time.
This is not an academic exercise - it's the very essence of a trading system. It also happens to be a subset of the requirements for Prolog (and similar languages).

Implementing #1 is easily done with a set of if-statements if you can assume a set of rules known at compile-time. Implementing #2 is easily done with a data-driven set of functions if you can assume a set of rule formats known at compile-time. #3 is the sticky wicket.

If you allow for run-time introspection, then you can easily build this using function factories. I would be very interested in hearing a solution that is not implemented on top of some form of run-time introspection. These systems tend to be written in a language that provides run-time introspection (either to the programmer or to the compiler). If they aren't, then the programmers tend to write an interpreter which, within it, provides run-time introspection. I haven't heard of a system that meets all three requirements and doesn't use run-time introspection as a key piece to solve the problem.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

In reply to Re: Runtime introspection: What good is it? by dragonchild
in thread Runtime introspection: What good is it? by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.