| Feature | Plastic (Current) | Rust |
|---|---|---|
| Keywords | Basic + Error Handling | Extensive |
| Data Types | Basic + List/Map/Array | Rich (u8, char, (), &str) |
| Ownership & Borrowing | Partial (WIP) | Core Feature |
| Functions | Basic, DLL Import, Closures | Advanced (generics, lifetimes) |
| Variables | let, mut, pub | let, mut, patterns, annotations |
| Operators | Arithmetic, Logical, Custom | Full set |
| Comments | // only | //, /* */, doc comments |
| Structs/Traits/Enums | Supported | struct, trait, enum |
| Error Handling | try, catch, throw, finally | Result, panic! |
| Imports/Plugins | import, reference, using, DLL | Advanced modules, crates |
| File/Process I/O | Built-in | Via stdlib |
| HTTP/Localhost | Built-in server | Via crates |
| Concurrency | Channels, Threads | Advanced (async, threads, channels) |
Plastic supports an extended set of keywords including control flow, data modeling, error handling, and plugin system:
fn, let, mut, pub, if, else, while, for, return, match, struct, enum, trait, impl, interface, try, catch, throw, finally, import, reference, using, dllimport
i32, i64, f32, f64, bool, string, voidarray, list, map, List<string>struct, enum, traitfn(...)anyPlastic includes experimental ownership and borrowing syntax: &, &mut, and supports borrow checks at compile-time (work in progress).
Support includes standard functions, closures, and DLL imports.
Includes arithmetic, logical, comparison, and custom operator aliases.
Single-line comments using //.
Plastic supports user-defined types and trait-based polymorphism.
Structured error handling: try, catch, finally, throw.
import, reference, using, and native dllimport.
Functions: readFile, writeFile, runProcess, openFile, etc.
Built-in HTTP server functions: startHttpServer, GetHttpRequestMethod, SetHttpResponse.
Built-in thread and channel system: CreateNewThread, SendToChannel, ReceiveFromChannel.
startHttpServer("8080");
while (true) {
let method: string = GetHttpRequestMethod();
let path: string = GetHttpRequestPath();
let data: string = GetHttpRequestData();
print("Received", method, path, data);
SetHttpResponse("Hello from Plastic!");
}
writeFile("test.txt", "Hello, file!");
let content: string = readFile("test.txt");
print(content);
SendToChannel("hello");
let msg: string = ReceiveFromChannel();
print(msg);
Note: Plastic is evolving rapidly. For the most recent syntax and feature updates, check the documentation and GitHub repository.