DEV Community

Cover image for Introducing Howl and Cosmo
Tea
Tea

Posted on

Introducing Howl and Cosmo

Cosmo is a modern shorthand for object oriented programming; Howl is a symbolic notation engine.

Howl and Cosmo conspire towards helping you write short and delightfully expressive OOP programs.

  • Muting language semantics (and very common words/idioms) feels good.
  • Learning isn't hard since all typing goes via snippets (still typing C#) and a little nitpicking.
  • Cosmo leans over a 100 notations; you need not adopt every notation; be it when generating/using snippets, or importing C# source.

Writing a new language is hard, adopting a new language is harder.

A notation (vs a whole new language) is easier and safer; bidirectional conversions between classic and abbreviated sources ensure we do not silo ourselves in shmancy new paradigms with uncertain futures.

Without further ado, a Hello Howl program.

‒̥ ┈ Main(ㄹ[] args){
    🐰 "Howl CLI v0.0.8\n";
    ⤴ (args❙ ☰ 0) (╯°□°)╯
                       ⌢ Ex("☆*:.。o(≧▽≦)o.。.:*☆");
    ⌢ CLI().Parse(args);
}
Enter fullscreen mode Exit fullscreen mode

Chances are, you can read this - reason being: strongly typed, object oriented programming is verbose and pedantic.

Ahead of Github and Unity asset store releases I will share a few samples and design decisions.

Modifiers and primitives

public is the most common word in most C# programs. Modifiers take up space and aren't often what we are looking for when reading sources.

Howl condenses and compacts modifier blocks, like so:

‒ public
◠ protected,
︲ internal,
▰ private
...
Enter fullscreen mode Exit fullscreen mode

One goal with modifier blocks was fitting a one character span; combining characters are used for this:

‒̥ public static
︲̥̑ protected internal static
Enter fullscreen mode Exit fullscreen mode

Control flow

Cosmo notations for control flow are endearing:

∘ ㅇ IsModifier(ㄹ x) {
    ⤴ (howlTemplate ☰ null) ⤬
    ⤵ ∀ (∙ k ∈ howlTemplate) ⤴ (k ☰ x) ㆑ ⤬
}
Enter fullscreen mode Exit fullscreen mode

C#

static bool IsModifier(string x) {
    if (howlTemplate == null) return false;
    else foreach (var k in howlTemplate) 
        if (k == x) return true; 
    return false;
}
Enter fullscreen mode Exit fullscreen mode

(Screaming anathema at and ? They may of course be written as ⮐ ✓; and ⮐ ✗;)

Linq expressions:

‒̥ ㄹ[] FilesOver(ㄹ π, ᆞ n, ㄹ pattern)
→ (‖ x ∈ FileSystem.Paths(π, pattern)
   ¿ x.NumberOfLines() > n
   ⏢ x.NumberOfLines() ◺
   ፥ x.FileName().Replace(".howl", ""))৴;
Enter fullscreen mode Exit fullscreen mode

Cosmo targets language keywords, semantics (𝕃 for List) and idioms (.ToArray()).

Testing

A few notations geared towards NUnit are included.

؟ Nits() → o( ω.nits.∋(ω.Rule(">=")) );

؟ Inject_Failed(){
    ∙ g = "These (__Bo__) are operators";
    ㄹ @out;
    ಠᴗಠ<InvOp>( ⎚ @out = TreeSitter.Inject(g, map) );
}

Enter fullscreen mode Exit fullscreen mode

C#

[Test] public void Nits() => o( ω.nits.Contains(ω.Rule(">=")) );

[Test] public void Inject_Failed(){
    var g = "These (__Bo__) are operators";
    string @out;
    Assert.Throws<InvOp>( () => @out = TreeSitter.Inject(g, map) );
}
Enter fullscreen mode Exit fullscreen mode

Parting words

Be it language or notation, a programming tool does not exist without a toolchain:

  • Full featured Unity integration
  • CLI; still very new, this is for the benefit of .net coders beyond Unity (also: build system integrations et caetera)
  • Input support (VS code, Atom) and syntax coloring (Atom).

The release will be announced here, or follow me on Twitter (@eelstork ).

NOTE: bunny face 🐰 not formally partaking the spec

Top comments (3)

Collapse
 
kamo profile image
KAIDI

Hey,
are there resources of the project?

Collapse
 
eelstork profile image
Tea

As hinted, resources up on Github later this week. Unity Asset store later this month after approval and some additional screening/testing on my end.

Collapse
 
kamo profile image
KAIDI

Thanks, my fault, I didn't see !!