Application: .ht
<<
name='Ada'
>>
<!doctype html>
<h1>Hello, <<name>></h1>Literal output until an execution block is opened. The block computes the value inserted into the output.
Express the work plainly. Put complexity in implementations, libraries, and the compiler—not in compulsory types and hierarchies.
An .ht file begins in literal-output context. It can serve HTML, JSON, CSS, an image, or anything an HTTP response can carry. A .lib begins in execution context. Both are compiled as h; what differs is where execution begins.
The file boundary answers one question: should source begin as content, or as instructions?
.ht<<
name='Ada'
>>
<!doctype html>
<h1>Hello, <<name>></h1>Literal output until an execution block is opened. The block computes the value inserted into the output.
.libfunction greeting(name) do
return 'Hello, '+name /return
/functionThe library is already execution context. There is no need to surround every function with << and >>.
.ht is an HTTP application: literal output can be any response body. Named overlays provide additional HTTP resources through selectors.There are clear names for conditions and repetition. Statements close explicitly, so neither braces nor indentation are required to define their scope.
if amount>0 then
status='Balance due'
else
status='Settled'
/ifThe conditional says what changes when a condition is true.
total=0
for name=i value=1 to 5 do
total=(total+i)
/forIteration is ordinary control flow, with explicitly named bounds.
pending=3
while pending>0 do
pending=(pending-1)
/whileThe loop continues while its condition remains true.
The same fundamental value can be treated differently by an operation. Interpretation is deliberate, not a declaration that the value has become an object.
h understands length-aware text, including null bytes. The value can represent letters, a JPEG, a network packet, a compiled bytecode stream, or any other content. No separate core table or image type is necessary.
a=1+2
# text: 12
b=(1+2)
# arithmetic: 3
label=concat('Order ',order_id)Outside mathematical parentheses, + joins text. concat() makes that intention unambiguous when values might look numeric.
total=(items+tax+shipping)
third=(1/3,20,19)
remainder=(total%3)Arithmetic is parenthesized. Precision can be specified per expression; the dedicated math document covers accuracy, rounding, and proposed defaults.
if active='yes' and attempts<3 then
allowed='yes'
/if
if not(authorized()) then
allowed='no'
/ifLogical operators describe decisions. Application-defined functions can participate in the condition.
person='{"name":"Ada"}'
name=person.json.['name']JSON structure can be interpreted through a library-defined accessor. h itself does not need to make JSON objects a fundamental type.
An h function expresses PARMS → PROCESSING → RETURN. Nothing about that shape demands an object instance or an inheritance hierarchy.
function balance() do
return orders_cost() /return
/functionfunction orders_cost() do
return items_cost()+taxes_cost()+shipments_cost() /return
/functionFunctions can be named to create as many useful layers as the engineer wants. They can be shallow or deep, directly implemented or composed of other functions. The name balance() stays stable while rules, algorithms and representations evolve beneath it.
length(data)
concat(first,last)
locate(data,needle)Common operations have built-in implementations that the runtime can optimize.
function balance() do
return orders_cost() /return
/function
expand file='pricing.lib' /expandA library supplies more functions and special-purpose interpretations. These are still ordinary h calls.
HTTP already gives us the request → processing → response model. h adopts it where it helps, without making additional object structure compulsory.
HTTP gives h an established resource and service model, including media types and character encoding. This is not an exclusive capability of h: an object-oriented application can use the same HTTP mechanisms.
<<overlay balance
webpush(balance(),'text/plain; charset=UTF-8')
>>
<<overlay profile
webpush(profile,'application/json; charset=UTF-8')
>>The public HTTP selector provides a service entry, not an instance method.
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
{"name":"Ada"}The same h value can be interpreted according to the media type. A charset is meaningful where the representation defines one.
The engineer chooses how much of the system is expressed as ordinary h and how much capability is granted to each execution environment.
Foundational execution and lower-level capabilities. It need not know what a file is.
Filesystem and storage capability can be implemented over more fundamental operations.
HTTP application execution, response production and service composition.
The h source language remains the same. The execution environment governs which operations are available. The compiler should optimize h, not force a data structure or an object model onto programmers.
Complexity belongs in the implementation, not in the programmer’s expression of the problem.
Questions, corrections and arguments are welcome. Signing in with an email address is enough to leave one.
No comments yet.