DEV Community

Sui Gn
Sui Gn

Posted on

Syntax of .me – Simple, Powerful, and Language-Agnostic

.me is not just another state library. It's a semantic kernel that lets you define your data and logic using simple paths and algebra.

You think in terms of what you want, not how to wire everything together.

Quick Start

import Me from "this.me";
const me = new Me();

me["@"]("jabellae");                    // Declare your identity

me.profile.name("Abella");
me.profile.bio("Building the semantic web.");

me.users.ana.name("Ana");
me.users.ana.age(22);

me.friends.ana["->"]("users.ana");      // Create relationships

// Automatic logic that applies to all friends
me.friends["[i]"]["="]("is_adult", "age >= 18");

console.log(me("friends.ana.is_adult"));        // → true
console.log(me("friends[age > 18].name"));      // → { ana: "Ana" }
Enter fullscreen mode Exit fullscreen mode

Core Concepts

  • Paths are the main way to address data (me.profile.name, me.users.ana.age)
  • Dot (.) creates hierarchy
  • [] is used for indexing, filtering and broadcasting
  • () reads or writes a value
  • = creates derived/computed values

Language Agnostic

The same logic works no matter what words you use:

// English
me.shop.items[1].price(100);
me.shop.items[1]["="]("total", "price * 1.16");

// Spanish
me.tienda.articulos[1].precio(100);
me.tienda.articulos[1]["="]("total", "precio * 1.16");

// Japanese
me.店舗.商品[1].価格(100);
me.店舗.商品[1]["="]("合計", "価格 * 1.16");
Enter fullscreen mode Exit fullscreen mode

Powerful Selectors

  • Fixed index: me.products[1].price
  • Broadcast to all: me.products["[i]"]
  • Filter: me.products[price > 50]
  • Range: me.products[1..3]
  • Multi-select: me.products[[1,3]]

Useful Operators

  • @ → Declare identity: me["@"]("username")
  • _ → Secret scope: me.wallet["_"]("key")
  • -> → Pointer: me.card["->"]("wallet")
  • = → Derivation: me.order["="]("total", "subtotal + tax")

Real-World Examples

E-commerce

me.products[1].price(1000);
me.products[1].discount(150);
me.products[1]["="]("final", "price - discount");
me("products[1].final");   // → 850
Enter fullscreen mode Exit fullscreen mode

Logistics

me.trucks[1].distance(500);
me.trucks[1].fuel(40);
me.trucks[1]["="]("efficiency", "distance / fuel");
me("trucks[1].efficiency");   // → 12.5
Enter fullscreen mode Exit fullscreen mode

Summary

.me gives you:

  • Infinite nesting without schemas
  • Reactive derived values
  • Structural privacy
  • Language-agnostic paths
  • One core, many surfaces

You define the meaning once.

The system handles the rest.


MIT License • Built in Veracruz, Mexico.

Top comments (0)