EvolveBlockMarkers
Structs ยท AiDotNet.Evolution.Programs
The start and end comment markers that delimit the editable region of a program.
Inheritance: ValueType โ EvolveBlockMarkers
Implements: IEquatable<EvolveBlockMarkers>
For Beginners
Think of these two strings as the tape around the part of a file that may be
changed. They are ordinary comments, so the file still compiles and runs with the tape in place. The default
pair uses #, which is how Python writes a comment; C#, Java, and JavaScript need // instead, and
SQL needs --. Use ForLanguage and you get the correct pair automatically; supply your own
pair through the constructor when your file format needs something different.
How It Works
A program-evolution run normally rewrites only part of a file: the imports, the harness, and the entry point
the evaluator calls have to survive untouched, while one clearly delimited region is offered to the model. The
reference OpenEvolve implementation hard-codes the Python-style markers # EVOLVE-BLOCK-START and
# EVOLVE-BLOCK-END, which are syntax errors in every C-like language. This value type carries the
marker pair explicitly, with ForLanguage supplying the right comment syntax per
ProgramLanguage, so the same evolution pipeline works for Python, C#, SQL, and anything else.
Constructors
| Constructor | Summary |
|---|---|
EvolveBlockMarkers(string start, string end) |
Initializes a marker pair. |
Properties
| Property | Summary |
|---|---|
EvolveBlockMarkers DoubleDash { get; } |
Gets the double-dash marker pair used by SQL. |
EvolveBlockMarkers Hash { get; } |
Gets the hash-comment marker pair used by Python, Ruby, shell, and YAML style sources. |
EvolveBlockMarkers Slash { get; } |
Gets the double-slash marker pair used by C, C++, C#, Java, JavaScript, TypeScript, Go, and Rust. |
string End { get; } |
Gets the text that closes an evolve block. |
string Start { get; } |
Gets the text that opens an evolve block. |
Methods
| Method | Summary |
|---|---|
EvolveBlockMarkers ForLanguage(ProgramLanguage language) |
Returns the marker pair whose comment syntax is valid in language. |
bool Equals(EvolveBlockMarkers other) |
|
bool Equals(object obj) |
|
bool op_Equality(EvolveBlockMarkers left, EvolveBlockMarkers right) |
Determines whether two marker pairs are equal. |
bool op_Inequality(EvolveBlockMarkers left, EvolveBlockMarkers right) |
Determines whether two marker pairs differ. |
int GetHashCode() |
|
string ToString() |
Returns the marker pair in a stable, culture-independent form. |