Recent from talks
Nothing was collected or created yet.
Curl (programming language)
View on WikipediaThis article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
| Curl | |
|---|---|
| Paradigms | multi-paradigm: object-oriented, markup |
| Designed by | Steve Ward, MIT |
| Developer | Curl, Inc., Sumisho Computer Systems Corp., SCSK Corporation |
| First appeared | 1998 |
| Stable release | 8.0.13
/ 6 September 2022 |
| Typing discipline | strong |
| OS | Windows |
| License | Curl license www |
| Website | www |
| Dialects | |
| none | |
| Influenced by | |
| HTML, JavaScript, Lisp | |
| |
Curl is a reflective object-oriented programming language for interactive web applications, whose goal is to provide a smoother transition between content formatting and computer programming. It makes it possible to embed complex objects in simple documents without needing to switch between programming languages or development platforms. The Curl implementation initially consisted of an interpreter only; a compiler was added later.
Curl combines text markup (as in HyperText Markup Language (HTML)), scripting (as in JavaScript), and heavy-duty computing (as in Java, C#, or C++) within one unified framework. It is used in a range of internal enterprise, business-to-business (B2B), and business-to-consumer (B2C) applications.
Curl programs may be compiled into Curl applets, that are viewed using the Curl RTE, a runtime environment with a plugin for web browsers. Currently, it is supported on Microsoft Windows. Linux, and macOS was dropped on March 25, 2019 (starting with version 8.0.10).[1] Curl supports "detached applets", which is a web deployed applet which runs on the user's desktop independent of a browser window much as in Microsoft Silverlight 3 and Adobe AIR.
Architecture
[edit]The Curl language attempts to address a long-standing problem: the different building blocks that make up any modern web document most often require wildly different methods of implementation: different languages, different tools, different frameworks, often completely different teams. The final, and often most difficult, hurdle has been getting all of these blocks to communicate with each other in a consistent manner. Curl attempts to side-step these problems by providing a consistent syntactic and semantic interface at all levels of web content creation: from simple HTML to complex object-oriented programming.
Curl is a markup language like HTML—that is, plain text is shown as text; at the same time, Curl includes an object-oriented programming language that supports multiple inheritance. Curl applications are not required to observe the separation of information, style, and behavior that HTML, Cascading Style Sheets (CSS), and JavaScript have imposed, although that style of programming can be used in Curl if desired.
While the Curl language can be used as an HTML replacement for presenting formatted text, its abilities range all the way to those of a compiled, strongly typed, object-oriented system programming language.[2] Both the authoring (HTML-level) and programming constructs of Curl can be extended in user code. The language is designed so Curl applications can be compiled to native code of the client machine by a just-in-time compiler and run at high speed. Curl applets can also be written so that they can run off-line when disconnected from a network (occasionally connected computing). The Curl IDE is an application written in Curl.
Syntax
[edit]A simple Curl applet for a "Hello, World!" program might be:
{Curl 7.0, 8.0 applet}
{text
color = "blue",
font-size = 16pt,
Hello World}
This code will run if the user has at least one of the Curl versions 7.0 or 8.0 installed.
Curl provides both macros and text-procedures in addition to anonymous procedures and named methods. An alternative using the text-procedure paragraph would be:
{paragraph
paragraph-left-indent=0.5in,
{text color = "red", font-size = 12pt,
Hello}
{text color = "green", font-size = 12pt,
World}}
Recently this style of layout has been adopted by "builders" in the Groovy language for the Java virtual machine (JVM), but is also familiar to users of CSS or Tcl/Tk. Most features for web applications now implemented through combinations of JavaScript libraries + HTML + CSS are already found within the Curl language, including features usually associated with Prototype + script.aculo.us such as accordion panes.
Curl sets callbacks in the manner also adopted by Groovy:
{CommandButton width=100pt,
height = 50pt,
label = {center {bold Invokes an event handler when clicked}},
control-color = "orange",
|| Attach the following event handler to this CommandButton
{on Action do
{popup-message
title = "Your Message",
"This is a user message dialog."
}
}}
Curl comments use the vertical bar in several variations. The simplest is as follows:
{text A comment can be on a line by itself,
|| A comment on a line by itself
or it can be at the end || A comment on the same line as code
of a line.}
As lightweight markup
[edit]Because Curl provides for both user-defined text procedures and style sheets, it can be used readily as domain-specific lightweight markup. A major advantage over plain text HTML markup is that the text encoding can be set to UTF-8, and text entered in a Unicode-enabled text editor with no escaping of characters (like JavaScript, Curl is Unicode friendly). A poetry example is:
{poem || wraps entire poem
{stanza || first verse here in any language
}
{stanza || another verse here in any language
}
}
which can initially be implemented by defining the poem and stanza markup as paragraph text formats. Stanza could be further refined to include a hidden navigation anchor for page navigation using the Curl {destination} which is itself a text procedure.
The same markup can be used for different results, as one can style text to be visible in one context and invisible in another. Curl also permits top-level file inclusion so that a source text in markup can be included in different parent files. In education, for example, one could create a source file of test questions, and include it in both a student and a teacher version of the text.
See also
[edit]- Homoiconicity: Curl is both a programming language and a data format[citation needed]
References
[edit]- ^ "Changes to Supported Operating Systems of Curl RTE Products". SCSK Corporation. Archived from the original on 2019-05-13. Retrieved 2020-04-01.
- ^ M. Hostetter; D. Kranz; C. Seed; C. Terman; S. Ward. "Curl: A Gentle Slope Language for the Web". MIT Laboratory for Computer Science. Archived from the original on 2008-12-24. Retrieved 2005-12-20.
External links
[edit]- MIT Curl Project, the results of the Curl research project at Massachusetts Institute of Technology's (MIT) Laboratory for Computer Science.
- Curl, Inc. and Curl International Corp. develop and distribute a suite of commercial products which are based on the results of the MIT research. Owned by SCSK Corporation a majority-owned unit of Sumitomo Corp.
- InfoWorld review of Curl 6.0 by Martin Heller. InfoWorld awarded Curl its 2008 Technology of the Year award in the Rich Internet Application category.
Curl (programming language)
View on GrokipediaHistory
Origins at MIT
The Curl programming language originated as a research project at the Massachusetts Institute of Technology's Laboratory for Computer Science (LCS) in 1995, conceived by Steve Ward and Mat Hostetter to address the fragmentation in web content creation tools of the era. At the time, web development relied on disparate technologies such as HTML for markup, JavaScript for client-side scripting, and server-side languages for computation, creating steep learning curves and integration challenges. The project, supported by DARPA funding from 1995 to 1998 under contract DABT63-95-C-0009, aimed to develop a unified language that would enable a seamless "gentle slope" progression from simple document authoring to full-fledged programming, allowing developers to handle everything from formatted text to interactive applets within a single framework. Early prototypes focused on bridging these web content layers, with research goals centered on creating a semantically consistent system that integrated markup, procedural code, and data representation without syntactic discontinuities. Key contributors included David Kranz, who adapted compiler technology from prior MIT work on the T language, Cotton Seed, and Chris Terman, all under Ward's leadership at LCS. These prototypes emphasized extensibility and performance, enabling smoother transitions between static content like HTML equivalents and dynamic elements akin to JavaScript or backend computing. An initial MIT implementation was developed by Kranz, demonstrating core capabilities though no longer maintained.[5][6] The first public demonstration of Curl occurred in 1997, when Steve Ward presented the language at a seminar in Hong Kong, highlighting its potential to accelerate web development by unifying content layers.[7] Technical reports from this period, such as the 1997 paper "Curl: A Gentle Slope Language for the Web" published in the World Wide Web Journal (Volume 2, Issue 2), detailed the project's foundations and early findings by Hostetter, Kranz, Seed, Terman, and Ward.[6] Among the key innovations in these MIT prototypes were a reflective object model, which allowed runtime inspection and modification of objects through first-class types and introspection for enhanced debugging and extensibility; support for multiple inheritance in the class-based system, enabling flexible code reuse with protection attributes; and just-in-time (JIT) compilation, featuring a platform-independent front end paired with back ends that generated native code incrementally for applet performance and portability.[5] These features laid the groundwork for Curl's object-oriented and reflective architecture, prioritizing conceptual unity over isolated web technologies.[6]Commercial Development and Acquisitions
Curl Corporation was established in 1998 as a spin-off from MIT to commercialize the Curl programming language, founded by a team of researchers including Steve Ward, who served as CTO, and Tim Berners-Lee.[8][9][10] The company focused on developing Curl into a commercial product for rich internet applications, securing over $70 million in venture funding and research grants by 2002, including a $17.9 million fourth-round investment led by investors such as Baker Capital.[11] This funding supported the transition from academic research to market-ready tools, emphasizing Curl's potential for unified web content creation. In April 2001, Curl Corporation released its first commercial product, Curl Surge 1.0, a software environment enabling client-side computing for interactive web applications with reduced server loads and smaller download sizes.[12] The acquisition of Curl Corporation by Sumisho Computer Systems Corporation (SCS), a Japanese software firm, occurred in 2004, integrating the technology into SCS's portfolio and facilitating expansion into the Japanese market through rebranding and localized development efforts.[1][13] In October 2011, SCS merged with CSK Corporation to form SCSK Corporation, a subsidiary of Sumitomo Corporation, which assumed full ownership and ongoing maintenance of Curl.[14] Under SCSK, Curl continued to evolve, with major releases such as version 7.0 in 2013, which enhanced graphics capabilities and added support for Windows 8 to improve RIA performance.[15] As of 2025, SCSK maintains Curl, with the latest updates including Curl RTE 8.0.15 released in October 2025.[16]Design Principles
Unified Markup and Code Architecture
Curl's unified markup and code architecture represents a hybrid design that embeds declarative markup for user interface elements—analogous to HTML or XML—directly within procedural code, eliminating the need for separate files and enabling a seamless blend of presentation and logic in a single source file. This integration allows developers to intermix formatted text, graphical layouts, and executable instructions without syntactic discontinuities, fostering a consistent paradigm for creating both static content and dynamic applications. By treating markup as programmable constructs, Curl avoids the layering issues common in traditional web technologies, where separate languages like HTML and JavaScript create maintenance overhead.[1][5] At the core of this architecture is a reflective object-oriented model where all elements, including text, images, and code segments, are represented as first-class objects inheriting from a base Graphic class, complete with introspection and modification capabilities at runtime. This model supports multiple inheritance, parameterized types, and a type lattice that enables extensible graphical hierarchies, allowing properties like font styles or layouts to propagate through object trees via nonlocal options. The reflective nature permits dynamic inspection and adaptation of objects, enhancing flexibility for building interactive user interfaces while maintaining strong static typing for reliability.[17][5] The compilation process involves just-in-time (JIT) translation of source code to native machine code, ensuring high performance through incremental and lazy evaluation tailored for document-like applications. Source code is processed into executable form without an intermediate abstract syntax tree explicitly detailed in foundational descriptions, but with caching mechanisms to optimize repeated compilations and support rapid prototyping. This approach underpins Curl's portability and safety, compiling locally to leverage platform-specific optimizations while encapsulating programs for secure execution.[1][17] Curl employs an applet model for deployment, packaging self-contained units that function as executable web content, downloadable via HTTP and runnable in a sandboxed environment provided by the Curl RTE. These applets support versioning for compatibility, offline execution through client-side data persistence, and security restrictions that limit untrusted code to a controlled "bigger sandbox" without user prompts, while allowing administrative grants for enhanced privileges. This model facilitates network-efficient delivery and disconnected operation, aligning with web standards like XML and SOAP.[18][5] The architecture's primary goals center on reducing impedance mismatch between content presentation, procedural logic, and deployment layers, creating a "gentle slope" that scales effortlessly from simple formatted pages to enterprise-scale applications. By unifying markup, scripting, and object-oriented features in one language, Curl minimizes context-switching for developers and promotes client-side computation to offload servers, ultimately aiming for a platform that excels across the full spectrum of web content needs.[1][5]Object-Oriented and Reflective Features
Curl supports object-oriented programming through a class-based model that incorporates multiple inheritance, allowing a class to derive from more than one superclass to facilitate complex hierarchies and reusable designs, such as in GUI components where a class likeTabContainer inherits from both Control and Box.[1] This feature enhances modularity by enabling developers to compose behaviors from diverse parent classes without redundant code.[8]
Reflective capabilities in Curl provide runtime introspection and manipulation of object metadata, treating types as first-class values that can be queried and used dynamically.[1] For instance, the {typeof v} operator returns the most specific type of a value v, while {isa t v} checks if v belongs to type t, supporting dynamic type testing and instance creation via the reflection API.[5] These mechanisms allow programs to inspect class hierarchies and adapt behaviors at runtime, particularly for trusted code, promoting flexible and extensible applications.[5]
Curl's metaprogramming facilities include procedural and hygienic macros, which function as rewrite rules to generate code and extend the language's syntax.[1] Developers can define custom macros to embed domain-specific languages, such as logic-programming constructs, within Curl applications, while built-in operators like if are implemented as macros for consistent extensibility.[1] This approach enables powerful code generation and customization without altering the core compiler.
Event-driven programming is integrated into Curl's object-oriented framework through declarative event handling, supporting callbacks for user interactions and asynchronous operations.[1] The on expression, for example, attaches handlers to events like PointerEnter on graphical objects, such as {on PointerEnter at v:VBox do set v.background = "orange"}, allowing responsive, non-blocking behaviors in interactive web content.[1] This ties seamlessly into the OO model, where events propagate through object trees for efficient handling.[5]
Exception handling in Curl follows a hierarchical model similar to C++ and Java, using try/catch blocks to intercept and propagate errors during execution.[19] Exceptions interrupt normal flow to invoke specialized handlers, ensuring robust error management in large-scale applications. Modularity is further supported by a package system that creates separate naming environments, with dynamic and static imports allowing controlled code reuse and namespace isolation to build scalable, maintainable systems.[1] Nested code blocks and lexical scoping complement this by enforcing visibility rules within modules.[1]
Syntax and Language Elements
Basic Syntax and Constructs
Curl's basic syntax revolves around expressions enclosed in curly braces{} for evaluation, with top-level text and code intermixed in applets. Expressions are evaluated from left to right, and variables are declared using the let or def keywords, allowing for local, global, or class scoping. Local variables are confined to the enclosing code block, while global variables declared at the top level persist throughout the applet unless overridden.[20][21]
The language supports primitive data types such as int for integers, double for floating-point numbers, String for text, char for single characters, and bool for boolean values. Collections include ordered arrays accessed by index and hash tables for key-value pairs, enabling efficient storage and retrieval. User-defined types can be created via classes, extending the type system for custom objects. Type can be explicitly specified during declaration (e.g., {let x:int = 5}) or inferred, defaulting to any for let declarations.[22][21]
Control structures include conditionals and loops for procedural flow. The if expression evaluates a boolean condition and executes a code block if true, optionally with else or elseif clauses for alternatives: {if condition then block1 else block2}. For example, {if x > y then {message.add "x is larger"} else {message.add "y is larger"}} adds a message based on the comparison. Loops feature for for iterating over ranges or containers (e.g., {for i:int = 0 to 5 do {message.add i}}), while for condition-based repetition ({while condition do block}), and until for repeating until a condition holds.[23][24]
Procedures, Curl's functions, are defined with define-proc, specifying parameters, return type, and body: {define-proc {procedure-name param:type}:return-type {body}}. Parameters are passed by value, with local scoping for inner variables shadowing outer ones. For instance, {define-proc {factorial n:int}:int {if n == 1 then 1 else n * {factorial n - 1}}} computes the factorial recursively. Procedures can be anonymous or assigned to variables for higher-order use.[25]
A simple "Hello, World!" example demonstrates basic output in an applet:
{Curl 8.0 applet}
{let greeting:String = "Hello, World!"}
{text Hello, World!}
{Curl 8.0 applet}
{let greeting:String = "Hello, World!"}
{text Hello, World!}
| Precedence | Operators | Description |
|---|---|---|
| 0 | # | Maybe-null access |
| 1 | - | Unary negation |
| 3 | *, /, div, mod, rem | Multiplication, division |
| 4 | +, - | Addition, subtraction |
| 5 | & | String concatenation |
| 6 | ==, !=, <, >, <=, >=, isa | Comparisons, type check |
| 7 | not | Logical NOT |
| 8 | and | Logical AND |
| 9 | or | Logical OR |
2 + 3 * 4, multiplication precedes addition, yielding 14.[27]
Integration of Markup and Procedures
In Curl, markup is fundamentally integrated with programming procedures, where tags such as {text} and {image} function as callable macros or text procedures that generate user interface elements dynamically during compilation and execution. These constructs allow developers to define lightweight, domain-specific notations that blend declarative markup with imperative code, enabling the creation of structured content like formatted text or embedded media without separating presentation from logic. For instance, {text font-style=italic "Hello, World!"} renders italicized text, while {image graphic-url="path/to/image.curl"} inserts an image object, both processed as procedure invocations that can accept parameters and return visual components.[5] The curly braces syntax {} serves as the core mechanism for evaluation, enclosing content that mixes static text with dynamic computations to produce executable markup. Plain text outside braces displays literally, but content within {} is parsed and evaluated as code, allowing seamless interpolation of variables, expressions, or procedure calls into markup flows. This fusion supports concise expressions like {bold "This is {value} bold text."}, where {value} computes a dynamic string insertion, blending markup rendering with procedural logic for responsive content generation.[5] Curl provides native support for Unicode, adhering to the Unicode Standard for character representation, which facilitates internationalization and multilingual markup without requiring character escaping in most cases. Characters are handled via Unicode values in ranges such as U+0000 to U+D7FF, U+E000 to U+FFFF, and supplementary planes, enabling seamless inclusion of global scripts in markup like {text "Café with π ≈ 3.14"} for diverse linguistic content. UTF-8 encoding is implicitly supported in source files and text processing, allowing developers to author and deploy internationalized applications directly.[28] Modularity in markup is achieved through the {require} directive, which includes external Curl files or resources at compile time, promoting reuse of markup snippets across modules. For example, {require "common-markup.curl"} loads reusable UI definitions, such as shared table or form templates, into the current scope without runtime overhead. This enables scalable designs, like dynamically generating a table with embedded computations: {table border-width=1 {row {cell "Price:"} {cell {* ball-price 2} dollars}} {row {cell "Quantity:"} {cell 2}}}, where arithmetic procedures compute cell values on evaluation.[5]Implementation and Tools
Compiler and Runtime Environment
The Curl compiler utilizes a just-in-time (JIT) pipeline to convert source code into native machine code on the client, enabling efficient execution of both markup and procedural elements. The process starts with lexing and parsing, where the lexer tokenizes input using a prefix syntax—enclosed in curly braces, such as{add 1 2}—inspired by Lisp, while supporting infix notation for common operators like + and >. Parsing builds an abstract syntax tree (AST) that integrates declarative markup with imperative code, facilitating the unified architecture of the language.[1]
Optimization occurs prior to JIT compilation, incorporating lazy expansion of parameterized classes to minimize code bloat and incremental evaluation to accelerate startup for interactive applications. The runtime engine (RTE), a core component, drives the JIT stage by generating platform-specific native code from the optimized AST or pre-parsed "pcurl" binaries, ensuring high runtime performance without requiring server-side processing. This dynamic compilation reduces download sizes and supports seamless updates via versioned packages fetched over the network.[1]
The Runtime Environment (RTE), available up to version 8.0.15 released in October 2025, oversees applet loading, execution, and rendering as a browser plug-in. It includes an automatic garbage collector for memory management, promoting type safety and preventing resource leaks in unprivileged contexts. The RTE integrates hardware-accelerated 2D/3D graphics libraries, a declarative GUI system for layouts and controls, and network support for protocols like HTTP, HTTPS, and SOAP to handle dynamic content. Multiple applets run in isolated memory spaces, with package caching for repeated access.[29][4]
Curl's security model sandboxes web applets to restrict interactions with the operating system, other programs, or unauthorized resources, limiting CPU, memory, and persistent storage usage. Permission controls require explicit user approval—often via the Curl Control Panel—for file or network access, with SSL verification for trusted sites; enterprise administrators can impose additional policies. This design enhances safety for client-side execution while allowing controlled privilege escalation.[1][29]
Performance is further optimized through incremental compilation, which recompiles only modified sections during development, and caching of compiled packages to minimize latency in iterative workflows. These features, combined with compact code formats, can yield an order-of-magnitude improvement in responsiveness for rich web applications compared to traditional interpreted environments.[1]
Backward compatibility is ensured via explicit version declarations in code, such as {curl 3.0 applet}, which the RTE uses to select appropriate libraries and behaviors, supporting legacy applications across major releases without modification and mitigating issues like "bit rot" from evolving standards.[1]
