Comp Language Tags Explained

Picture extending true and false with 'maybe' without breaking a thing. Comp's tags do just that, weaving hierarchies into every corner of the language.

Comp's Tags: When Keywords Become Extensible Hierarchies — theAIcatchup

Key Takeaways

  • Comp tags turn keywords into extensible hierarchies, extending builtins like bool without breakage.
  • They eliminate stringly-typed enums, powering units, shapes, and parameter inference natively.
  • Dual role as shapes and values enables powerful, discoverable code organization.

A developer hunched over a laptop in a rainy Berlin co-working space types !tag comp.bool {maybe}, and watches their code namespace light up with possibility.

Comp language tags. They’re not just a feature — they’re the glue holding this emerging language together, rethinking what keywords even mean. Forget rigid builtins; here, true and false sit as humble tags in a hierarchy you can extend at will. It’s wild. Skip and stop? Those aren’t special syntax either. Just tags, invoked like any other value.

But here’s the kicker.

How Does Comp Bake Tags Into Everything?

Defining them is dead simple, right in a module: !tag severity {high medium low}. Boom — hierarchy born. Pull in others? Extend away, but only internally, so you don’t trash the original. It’s polite polymorphism.

!tag severity {high medium low} !tag comp.bool {maybe}

That blockquote? Straight from Comp’s docs. See how maybe slots under bool without the core knowing? Namespaces flex too — maybe works solo if unambiguous, or bool.maybe for precision. No global pollution. Clean.

This dual life — tags as both shapes and singletons — echoes old Lisp symbols, but grounded. (Lisp let everything be a symbol; Comp channels that energy into practical types.) Units like 24#second? Tagged values. SQL snippets? Tagged strings. Even morphing structs to shapes bows to tag precedence.

Short para. Impact? Parameters in function calls snap into place smarter, inferred by tags. No more “parse this crap” boilerplate.

Why Ditch Strings for Tags in Comp?

Strings suck for enums. Always have. They’re opaque, error-prone, typos galore — “hight” instead of “high,” and your severity check crumbles. Tags? Named, hierarchical, discoverable. Compiler groks them natively.

Think about it. In Rust, enums are powerhouses but verbose. TypeScript unions? Stringly-typed hell. Comp tags hit a sweet spot: quick-define, extendable, serializable even as “raw tags” from unknown modules. Promote later? Sure, once the module loads.

And flow control. Skip (continue) and stop (break) as tags means you could — theoretically — tag-condition them. if skip.on.error or whatever. Mind bends.

But Comp’s not hype machine. It’s architectural: tags enforce intent everywhere, from units to behaviors. My unique take? This mirrors database schemas bleeding into code — like Postgres enums, but language-wide. Prediction: it’ll spawn tag-libraries for domains, think ML tags for tensor shapes or devops tags for pipeline stages. Companies chasing type-safety will fork this hard.

One sentence: Revolutionary? Nah. Evolutionary genius.

What Happens When Tags Meet Real Codebases?

Scale it up. Imagine a microservices mess where every service tags its errors hierarchically: api.severity.high vs db.severity.medium. Cross-module? Raw tags serialize, deserialize safe. Promote on load — no runtime surprises.

Parameter assignment shines here. Functions expect tagged shapes; args morph accordingly. High precedence means tags override ambiguities. It’s like Haskell types on steroids, minus the ceremony.

Critique time. Comp’s docs gloss over edge cases — what if hierarchies clash on import? Or cycles in extensions? They’re teasing “mountain of details,” but that’s PR spin for “we’re iterating.” Fair. Early languages stumble.

Yet the why clicks: strings fragment intent; tags unify it. In a world of YAML fatigue and config drift, this feels like oxygen.

Deep breath. We’ve seen units tagged — 24#second intuitive, type-checks conversions. SQL? “select version()”#sql hints parsers. Shapes from structs? Tags dictate.

Wander a sec: reminds me of Swift’s associated types, but looser, friendlier. Comp assumes you’re smart — no handholding.

Why Does This Matter for Tomorrow’s Languages?

Architectural shift. Tags democratize extension without breakage. Bool.maybe doesn’t nuke true/false; it nests. Parallel? XML namespaces gone right, but in code.

Bold call: if Comp gains traction (it’s niche now), expect copycats. Go 2.0? Tags for errors. Python? TypedDicts evolve here. Why? Devs crave this — less ceremony, more structure.

Unknown modules? Serialize raw, promote later. Opaque at first, crystal once resolved. Game for plugins, configs, APIs.

Punchy. Tags fix the “stringly typed” plague.

Dense wrap: Flow control as tags opens meta-programming doors — tag your breaks with reasons, trace ‘em. Units prevent footguns. Shapes morph reliably. Parameters infer. Dual role (shape + value) powers generics sans generics. It’s a toolkit disguised as syntax.


🧬 Related Insights

Frequently Asked Questions

What are Comp language tags?

Hierarchical named values you define and extend, used as booleans, control flow, units, types — basically keywords on steroids, avoiding string pitfalls.

How do you define and use Comp tags?

!tag name {subtag1 subtag2} in a module; use as name.subtag or shorthand if unique. Extend internals without polluting originals.

Will Comp tags replace enums in other languages?

Not soon, but they’ll inspire — hierarchical, extensible, serializable wins over flat enums.

Marcus Rivera
Written by

Tech journalist covering AI business and enterprise adoption. 10 years in B2B media.

Frequently asked questions

What are Comp language tags?
Hierarchical named values you define and extend, used as booleans, control flow, units, types — basically keywords on steroids, avoiding string pitfalls.
How do you define and use Comp tags?
!tag name {subtag1 subtag2} in a module; use as name.subtag or shorthand if unique. Extend internals without polluting originals.
Will Comp tags replace enums in other languages?
Not soon, but they'll inspire — hierarchical, extensible, serializable wins over flat enums.

Worth sharing?

Get the best AI stories of the week in your inbox — no noise, no spam.

Originally reported by dev.to

Stay in the loop

The week's most important stories from theAIcatchup, delivered once a week.