Skip to content

Commit a160fa4

Browse files
committed
Update README.md
1 parent d30c384 commit a160fa4

File tree

1 file changed

+8
-64
lines changed

1 file changed

+8
-64
lines changed

README.md

Lines changed: 8 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ the expressiveness and ease-of-use of scripting languages with Rust's key design
1111
- **Static Typing**: Type annotations with inference capabilities for safer scripts
1212
- **Types and Methods**: Data structures with associated methods via `impl` blocks
1313
- **Control Flow**: Standard control structures (`if`/`else`, `while` loops)
14-
- **Traits**: Define shared behavior across types with trait definitions
1514

1615
## Rust Influences
1716

@@ -21,7 +20,6 @@ Tea brings Rust's safety concepts to scripting:
2120
- **Impl Blocks**: Methods are defined separately from type definitions using `impl` blocks
2221
- **Type Annotations**: Optional but explicit type annotations with `:` for safer scripts
2322
- **Arrow Syntax**: Function return types specified with `->`
24-
- **Traits**: Rust-style trait system for defining shared behavior
2523
- **Memory Safety Focus**: Controlled mutability helps prevent common scripting errors
2624

2725
## Syntax Overview
@@ -39,7 +37,8 @@ let opt_var: i32? = 5; // Optional type
3937
let mut opt_mut: f32? = 2.0; // Optional mutable type
4038
```
4139

42-
**Optional Types**: Types can be marked as optional using the `?` suffix. Optional types can hold a value or be null, providing safer handling of potentially absent values.
40+
**Optional Types**: Types can be marked as optional using the `?` suffix. Optional types can hold a value or be null,
41+
providing safer handling of potentially absent values.
4342

4443
### Functions
4544

@@ -142,47 +141,6 @@ let comparison = x > y && z <= w;
142141
let negation = -value;
143142
```
144143

145-
### Traits
146-
147-
Define shared behavior across types with traits:
148-
149-
```tea
150-
trait Drawable {
151-
fn draw();
152-
fn area() -> f32;
153-
}
154-
155-
trait Movable {
156-
fn mut move_to(x: f32, y: f32);
157-
fn get_position() -> Point;
158-
}
159-
```
160-
161-
Implement traits for structs:
162-
163-
```tea
164-
impl Drawable for Rectangle {
165-
fn draw() {
166-
// Draw rectangle implementation
167-
}
168-
169-
fn area() -> f32 {
170-
return self.width * self.height;
171-
}
172-
}
173-
174-
impl Movable for Rectangle {
175-
fn mut move_to(x: f32, y: f32) {
176-
self.x = x;
177-
self.y = y;
178-
}
179-
180-
fn get_position() -> Point {
181-
return new Point { x: self.x, y: self.y };
182-
}
183-
}
184-
```
185-
186144
## Data Types
187145

188146
- `i32` - 32-bit signed integer numbers
@@ -238,7 +196,8 @@ Native functions in C must follow this signature:
238196
tea_val_t your_function_name(tea_ctx_t* context, const tea_fn_args_t* args)
239197
```
240198
241-
The function receives a context and a list of arguments, and must return a `tea_value_t`. Arguments are accessed by calling `tea_function_args_pop()` in a loop. Here's an example:
199+
The function receives a context and a list of arguments, and must return a `tea_value_t`. Arguments are accessed by
200+
calling `tea_function_args_pop()` in a loop. Here's an example:
242201
243202
```c
244203
// Native function to print values (similar to built-in print)
@@ -348,9 +307,9 @@ Native functions work with the `tea_val_t` type system:
348307

349308
1. **Always validate arguments**: Use `tea_fn_args_pop()` to safely access arguments and check for NULL
350309
2. **Handle errors gracefully**: Return `tea_val_undef()` for error conditions
351-
3. **Memory management**:
352-
- Always call `tea_free_var(context, arg)` for each argument you pop
353-
- Strings returned from native functions should be allocated with `tea_malloc`
310+
3. **Memory management**:
311+
- Always call `tea_free_var(context, arg)` for each argument you pop
312+
- Strings returned from native functions should be allocated with `tea_malloc`
354313
4. **Performance**: Use native functions for computationally intensive operations
355314
5. **Argument handling**: Process arguments in the order they were passed by calling `tea_fn_args_pop()` sequentially
356315

@@ -370,21 +329,6 @@ cmake -B build -DCMAKE_BUILD_TYPE=Debug
370329
cmake --build build --parallel
371330
```
372331

373-
### With Ninja (Faster builds)
374-
375-
```bash
376-
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
377-
cmake --build build
378-
```
379-
380-
### Traditional approach
381-
382-
```bash
383-
mkdir build && cd build
384-
cmake .. -DCMAKE_BUILD_TYPE=Release
385-
make -j$(nproc)
386-
```
387-
388332
## Language Status
389333

390334
Tea is currently in development. The core language features are implemented including:
@@ -398,8 +342,8 @@ Tea is currently in development. The core language features are implemented incl
398342
- ✅ Expression evaluation
399343
- ✅ Type system foundations
400344
- ✅ Native function binding
401-
- ✅ Trait system for shared behavior
402345

403346
**Planned Features:**
347+
404348
- 🔄 Advanced type inference
405349
- 🔄 Module system

0 commit comments

Comments
 (0)