# Static Meta-Programming

## Problem

How do we do meta-programming(Reflection/Code-generation) without the usual use of reflection.

## Proposal &#x20;

#### Solution Requirements:

* no annotations
* structured
* retains reference of generated code

#### Syntax:

```
static extention <name> on <selector> {

}
```

```dart
class DataClass {
    const DataClass._();
}
```

```dart
DataClass Person(String name, {String Address}){
    String NameFirstChar(){
        return name.first;
    }
}
```

```dart
static extention DataClass<T> on DataClass<T> Function {


    DataClass from
    Map<String, dynamic> toJson();
    String toString();

}
```

```dart
@data class Person {String name, String Address}
static extention DataClass<T> on @data<T> {
    T fromJson(Map<String, dynamic> json);
    Map<String, dynamic> toJson();
    String toString();
    Spec _$generate(){
        // access to reflection data
        return generatedCode;
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ideas.aligator.ir/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
