Objectives of Chicory

Chicory is a new programming language designed with the aim of providing a safer, more enjoyable, and highly productive development experience, particularly for building modern web applications. It draws inspiration from various successful languages while forging its own path to address common challenges in software development.

Core Objectives

  • Safety and Reliability through Static Typing: Chicory embraces static typing as a cornerstone for building robust applications. By catching errors at compile time, Chicory aims to significantly reduce runtime surprises and increase the overall reliability of code. This is achieved through a rich type system that encourages explicit type definitions and strong type checking.

  • Developer Experience and Productivity: Chicory prioritizes a clean, consistent, and expressive syntax to enhance readability and maintainability. It aims to provide excellent tooling, including helpful error messages, auto-completion, and refactoring capabilities, to boost developer productivity. The goal is to make writing correct code feel natural and intuitive.

  • Web Development Focus (with broader potential): The inclusion of JSX syntax directly within the language grammar strongly indicates a focus on front-end web development. Chicory aims to be a compelling choice for building user interfaces, leveraging the component-based paradigm and declarative UI principles. However, Chicory’s design isn’t strictly limited to the web, and its general-purpose nature could extend to other domains in the future.

  • Principled Language Design: Chicory seeks to be a language with a coherent and well-reasoned design. It aims to avoid unnecessary complexity and strive for elegance in its features and syntax. Drawing inspiration from functional programming concepts (like ADTs and pattern matching) can lead to more predictable and maintainable code.

Chicory vs. TypeScript

While both Chicory and TypeScript are statically typed languages aiming to improve JavaScript development, they differ in key aspects:

FeatureChicoryTypeScript
RuntimeJavaScript runtimeJavaScript runtime
Type SystemMore opinionated, stricterGradual typing, structural typing, more flexible
SyntaxSimilar to TS, aiming for clarity and consistencySuperset of JavaScript, familiar for JS devs
EcosystemImmature ecosystemMature, vast JavaScript ecosystem
InteroperabilityAim for seamless interop (but not an immediate goal)Seamless JavaScript interoperability
PhilosophyStricter safety, ADTs, more functional philosophyGradual adoption, pragmatic, JS compatibility

Chicory aims to be more opinionated about type correctness and potentially enforce stricter rules from the outset. TypeScript, being a superset of JavaScript, prioritizes gradual adoption and interoperability with the existing JavaScript ecosystem. Chicory might sacrifice some of this immediate interoperability for stronger guarantees and a more cohesive language design. TypeScript’s structural typing provides flexibility but can sometimes lead to subtle type errors; Chicory’s type system (based on the grammar showing ADTs, Records, Tuples) might lean towards a more nominal or algebraic approach, emphasizing explicit type definitions and pattern matching.

In essence, TypeScript is a pragmatic evolution of JavaScript, adding static typing to an existing language and ecosystem. Chicory is potentially a fresh start, designed from the ground up with static typing and safety as core principles, even if it means building a new ecosystem.

Chicory vs. JavaScript

The contrast between Chicory and JavaScript is more stark:

FeatureChicoryJavaScript
Type SystemStatically typedDynamically typed
Error DetectionCompile-time errorsRuntime errors
PerformancePotential for optimizations due to static typesRuntime dynamism can hinder optimizations
ToolingAims for strong tooling from the startTooling has evolved to address dynamic nature
SafetyDesigned for safety and reliabilityProne to runtime errors, requires careful testing
ParadigmPotentially leaning towards functionalMulti-paradigm, often used imperatively

Chicory directly addresses the inherent safety concerns of JavaScript’s dynamic typing. By enforcing types at compile time, Chicory eliminates many classes of runtime errors common in JavaScript development. This leads to more predictable and maintainable code, especially in larger and more complex projects. JavaScript’s flexibility and dynamism are its strengths for rapid prototyping and smaller projects, but they can become liabilities in larger, long-lived applications. Chicory aims to provide the expressiveness and developer productivity needed for modern applications while mitigating the risks associated with dynamic typing.

Chicory vs. Elm

Comparing Chicory to Elm, another statically typed language focused on front-end development, reveals interesting similarities and potential divergences:

FeatureChicoryElm
Type SystemStatically typed, ADTs, Records, TuplesPurely functional, strong static typing
ParadigmLikely functional influences, but maybe not purely functionalPurely functional, emphasis on immutability
Error HandlingAims for compile-time safety“No Runtime Exceptions” guarantee in practice
Front-end FocusStrong JSX support, web UI developmentDesigned specifically for front-end, Elm Architecture
Community/EcosystemNew, building communityMature Elm community, focused but smaller
Learning CurvePotentially familiar syntax (JSX, etc.)Elm’s pure functional paradigm is distinct

Both Chicory and Elm prioritize safety and reliability through static typing. Elm is renowned for its “No Runtime Exceptions” guarantee, achieved through its purely functional nature and rigorous type system. Chicory, while aiming for similar safety benefits, might adopt a slightly less purely functional approach or a different balance in its type system.

Chicory’s inclusion of JSX suggests a strong focus on component-based UI development, similar to Elm’s strengths in front-end. However, Elm is explicitly and primarily designed for front-end web development, whereas Chicory’s grammar, while web-focused, might have broader ambitions. Elm’s purely functional paradigm and the Elm Architecture are central to its identity, while Chicory’s design choices in terms of paradigm and architecture are still emerging based on the grammar.

Chicory could be seen as exploring a space that shares Elm’s safety goals for front-end development but potentially with a syntax and paradigm that feels more familiar to developers coming from JavaScript or TypeScript, and possibly with a broader application scope beyond just the browser.

Conclusion

Chicory is positioned as a modern, statically typed language striving for safety, developer productivity, and a delightful development experience, particularly for web applications. By learning from the successes and challenges of languages like TypeScript, JavaScript, and Elm, Chicory aims to carve out its own niche by offering a compelling blend of strong typing, expressive syntax, and a focus on building reliable and maintainable software. As a new language, its exact trajectory and community will shape its future, but its stated objectives and initial grammar suggest a promising direction for a safer and more enjoyable way to build software.