Softanza: Functions as Linguistic Artifacts - A Comprehensive Narration
Softanza operates on a fundamental principle: functions should mirror the linguistic patterns of human communication. This isn't achieved through complex machine learning or natural language processing systems, but through an elegant design philosophy that embeds natural-language semantics directly into function names, parameters, and behaviors.
par Mansour Ayouni · dans le dépôt depuis le 2025-09-24 · essai de paradigme · domaine Traitement du langage et linguistique
Cet article est écrit en anglais, comme la bibliothèque.
Imagine a programming language where code reads like natural conversation, where functions adapt to human thought patterns rather than forcing programmers into rigid syntactic constraints. This is the revolutionary vision of Softanza, a foundation library for the Haro programming language that transforms functions from mere technical constructs into sophisticated linguistic artifacts.
The Core Philosophy: Programming as Natural Expression
The library treats every function as hosting its own embedded domain-specific language, leveraging the structure, semantics, and behavior inherent in function names, parameter ordering, types, and outputs. This creates a programming environment where expressing logic feels as intuitive as natural conversation.
Function Forms: A Rich Linguistic Taxonomy
Active and Passive Forms: Verbs in Action
Softanza distinguishes between active and passive function forms, mirroring grammatical structures in human language. The active form directly modifies objects:
o1 = new stzString("HAxxRxO")
? o1.Content() #--> "HAxxRxO"
o1.RemoveAll("x") # Actively modifies the object
? o1.Content() #--> "HARO"illustration
The passive form preserves the original while returning a transformed version:
o1 = new stzString("HAxxRxO")
? o1.AllRemoved("x") #--> "HARO" (returns transformed copy)
? o1.Content() #--> "HAxxRxO" (original unchanged)illustration
This linguistic distinction eliminates the ambiguity that plagues traditional programming languages, where the side effects of functions often remain unclear.
Fluent and Immutable Forms: Chaining Thoughts
The fluent form enables elegant chaining that reads like a sequence of natural actions:
o1 = new stzString("haxxrxo")
? o1.Content() #--> "haxxrxo"
? Q("haxxrxo").
RemoveQ("x").
ReplaceQ("i", :With = AHeart()).
UppercaseQ().
Spacified()
#--> R ♥ N Gillustration
The immutable form (QC) provides state-safe transformations, ensuring original objects remain untouched during complex operations. This addresses a critical challenge in programming: balancing expressiveness with data integrity.
Partial Forms: The Grammar of Parts
Perhaps most innovative is the partial form, which solves a fundamental limitation of object-oriented programming. Traditional languages force operations on the object rather than its parts, but Softanza enables operations on substring sections:
o1 = new stzString("HAxxRxO")
? o1.Content() #--> "HAxxRxO"
? o1.@All("x").@Removed() #--> "HARO"
? o1.Content() #--> "HAxxRxO" (original unchanged)illustration
This reads naturally as "all x removed" rather than the awkward "x all removed," demonstrating how Softanza prioritizes linguistic elegance.
Plural Forms: Eliminating Repetitive Logic
The plural form extends any singular operation to collections automatically:
o1.RemoveMany(["_", "~", "*"])
illustration
This eliminates the need for explicit loops and makes collective operations as simple as singular ones, reflecting how human language naturally handles plural concepts.
Exceptional Forms: Real-World Nuance
The exceptional form handles real-world complexity gracefully:
o1.RemoveNonLettersExcept("_")illustration
This addresses scenarios where simple rules need intelligent exceptions, mirroring how human communication naturally incorporates qualifications and exceptions.
Negative Forms: Natural Logical Negations
Rather than forcing programmers to use awkward NOT constructs, Softanza provides direct negative forms:
? Q("*").IsNotLetter() # Instead of NOT Q("*").IsLetter()illustration
This creates more readable logical expressions that align with natural language patterns.
Advanced Linguistic Features
Extended Forms: The XT() Hierarchy
Before exploring conditional operations, Softanza provides Extended forms (XT) that add sophistication to basic functions:
# Basic form
o1 = new stzString("hello world")
? o1.Content() #--> "hello world"
? o1.Replace("o", :With = "*") #--> "hell* w*rld"
# Extended form - additional parameters and control
? Q("Hello World").ReplaceXT("o", :With = "*", :CS = FALSE)
#--> "Hell* W*rld" (case-insensitive replacement)illustration
Conditional Forms: Logic as Constraint
The W() suffix ("Where") constrains a function with a per-item condition. The
condition is a small textual DSL compiled and evaluated by the Zig engine —
fast, and safe to accept even from untrusted sources (it cannot escape its
sandbox). No eval() is involved.
o1 = new stzList([ 4, 7, 10, 3, 8 ])
? @@( o1.FindW('{ @item > 5 }') ) #--> [ 2, 3, 5 ]
? @@( o1.FindW('{ IsEven(@item) }') ) #--> [ 1, 3, 5 ]
? o1.CountW('{ @item > 5 and IsEven(@item) }') #--> 2illustration
When you need real Haro logic (your own functions, object methods, anything the
DSL deliberately doesn't allow), use the WF() form, which takes an
anonymous function — full power, still no eval():
o2 = new stzList([ "alpha", "BETA", "gamma", "DELTA" ])
? @@( o2.FindWF( func x { return Q(x).IsUppercase() } ) ) #--> [ 2, 4 ]illustration
Note: the
WDSL is both fast and fully expressive, so the olderW-vs-WXTsplit (a speed/expressiveness trade-off from theeval()era) is gone —WXTis now a deprecated alias ofW. See the dedicated Conditional Code in Softanza narration for the full DSL grammar, the builtin set, and theW/WFdecision guide.
This replaces verbose looping constructs with concise, expressive conditions that focus on intent rather than implementation mechanics.
Named Parameters: Self-Documenting Intent
Softanza transforms cryptic parameter sequences into readable narratives:
o1 = new stzList([1, 2, 3, 4, 5]) ? o1.Content() #--> [1, 2, 3, 4, 5] o1.SwapItems(:AtPositions = 1, :And = 3) ? o1.Content() #--> [3, 2, 1, 4, 5]
illustration
The code becomes self-documenting, eliminating the need for extensive external documentation.
Function Prefixes and Suffixes: Embedded Intelligence
Prefixes like viz add visual representation capabilities:
# Basic form first
o1 = new stzString("RINGORIALAND")
? o1.FindAll("I") #--> [2, 6]
# Then visual form
? o1.vizFindAll("I")
# --> RINGORIALAND
# -^----^-----illustration
Suffixes encode parameter meanings directly into function names. The CS suffix indicates case sensitivity, ST indicates starting position, eliminating parameter ambiguity:
o1 = new stzString("Haro is great")
? o1.Content() #--> "Haro is great"
? o1.FindNextSTCS("haro", 5, FALSE) #--> 0 (not found from position 5)
? o1.FindNextSTCS("haro", 1, FALSE) #--> 1 (found at position 1, case insensitive)illustration
From the name alone, programmers understand the parameter order and meaning: substring, starting position, case sensitivity flag.
Small Functions with Grand Impact
Softanza includes powerful utility functions that maximize expressiveness while minimizing syntax:
Q(val): Elevates values to queryable objects and enables action chaining@@(val): Provides readable string representations for complex data structures@(val): Introduces partial values for sophisticated transformations
These small functions eliminate repetitive syntactic overhead, allowing programmers to focus on problem-solving rather than language mechanics.
Revolutionary Advanced Forms
Future Forms: Programming with Temporal Logic
Softanza introduces temporal programming through future forms using F() and FF() suffixes:
o1 = new stzString("ringo")
? o1.Content() #--> "ringo"
? BeforeQ('').UppercasingF("ringo"). # F() defers the action
RemoveFF("o").FromItQ(). # FF() executes the chain
SpacifyItQ().
AndThenQ().ReturnIt()
#--> H A R Oillustration
F() defers methods in the processing chain, while FF() immediately executes the entire accumulated chain. Actions can be deferred and executed at optimal moments, reflecting how humans naturally plan and sequence tasks.
Random Forms: Gamification Built-In
Any function can be randomized with the rnd prefix:
? o1.rndNItems(3) # Get 3 random items o1.rndRemoveItems() # Remove random number of items
illustration
This transforms routine data processing into engaging, game-like interactions without additional complexity.
Deep Forms: Recursive Operations Made Simple
Deep forms handle nested data structures elegantly:
# Show nested structure first
aList = [ "you", ["are", "you"], "awesome" ]
o1 = new stzList(aList)
? @@(o1.Content()) #--> [ "you", [ "are", "you" ], "awesome" ]
# Apply DeepReplace
o1.DeepReplace("you", :By = "♥")
? @@(o1.Content()) #--> [ "♥", [ "are", "♥" ], "awesome" ]illustration
Complex recursive operations become single, intuitive function calls that work regardless of nesting depth.
FreeForm Functions: Ultimate Flexibility
FreeForm Functions (FX) allow parameter flexibility and intelligent defaults:
o1 = new stzString("I love Haro programming")
? o1.Content() #--> "I love Haro programming"
# Parameters in any order
? o1.SectionFX([:To = 11, :From = 8]) #--> "Haro"
? o1.SectionFX([:From = 8, :To = 11]) #--> "Haro" (same result)
# Intelligent defaults when parameters omitted
o2 = new stzString("hello world")
? o2.ReplaceNextOccurrenceFX([]) #--> Uses intelligent defaultsillustration
Programmers can provide parameters in any order or omit them entirely, with Softanza intelligently inferring intent. The FX suffix distinguishes FreeForm from Future forms (F/FF).
Multilingual Programming: Universal Expression
Softanza breaks the English-only barrier in programming:
? DernierCaractère() # French for LastChar() ? الحرف_الأخير() # Arabic for LastChar() ? 字符数() # Chinese for NumberOfChars()
illustration
This democratizes programming by allowing developers to code in their native languages, making technology more accessible globally.
Innovative Quality-of-Life Features
Misspelled Forms: Intelligent Error Correction
Softanza automatically corrects common typos:
? Q(" Haro ").WithoutSapces() # Works despite "Sapces" misspellingillustration
This reduces frustration and maintains flow during development, particularly helping non-native English speakers.
Statement Forms: Logic as Natural Assertions
The X() suffix enables natural logical statements:
? AllNumbersInQQX([ -2, -4, -21 ]).AreNegativeX() #--> TRUE ? NoNumberInQQX([ -2, -4, -21, 10800 ]).IsPositiveX() #--> FALSE
illustration
Complex logical validations become readable assertions that mirror human reasoning.
The Technical Achievement
What makes Softanza remarkable is achieving natural language expressiveness without machine learning or NLP systems. Instead, it uses pure linguistic design principles embedded in function architecture:
- Systematic naming conventions that encode semantic meaning
- Parameter ordering that reflects natural language structure
- Flexible form variations that accommodate different thinking styles
- Intelligent defaults that reduce cognitive overhead
- Self-documenting syntax that eliminates external documentation needs
The Dual Benefits: Writability Meets Readability
Softanza challenges the conventional wisdom that writability and readability are competing goals. By treating functions as linguistic artifacts, it achieves both simultaneously:
Enhanced Writability: Programmers express ideas as naturally as they think them, reducing mental translation overhead between thought and code.
Improved Readability: Code becomes self-explanatory, reading like structured natural language that any literate person can understand.
Reduced Errors: Clear, descriptive functions minimize misunderstandings and create more reliable software.
Computational Flexibility: Multiple expression paths accommodate different cognitive styles, freeing programmers from rigid syntactic constraints.
The Broader Vision
Softanza represents more than a programming library—it's a paradigm shift toward human-centered computing. By embedding natural language semantics directly into computational structures, it bridges the gap between human thought and machine execution without requiring complex AI intermediaries.
This approach suggests a future where programming becomes as accessible as written communication, where the barrier between human intent and computational implementation dissolves through thoughtful linguistic design rather than artificial intelligence complexity.
The library demonstrates that the path to more human-friendly programming lies not in making computers understand natural language, but in designing programming languages that naturally align with human communication patterns. In doing so, Softanza transforms the act of programming from technical syntax manipulation into expressive, intuitive communication with computational systems.
Lectures liées
- Conditional Code in Softanza — Constraining Functions with W and WF
- Decoding Duplicates: Exploring Duplicate Detection and Removal with Softanza
- The Narrative of Transformations: Tracking Object History in Softanza
- Softanza Near-Natural Programming Tutorial
Citer
Mansour Ayouni. « Softanza: Functions as Linguistic Artifacts - A Comprehensive Narration ». Softanza narrations, 2025. https://mayouni.github.io/stzsite/fr/narrations/stz-function-forms-narration.html
Non exécuté : son code touche aux fichiers, au réseau, à l'horloge ou au hasard. L'article est publié tel qu'il est écrit ; ses blocs sont des illustrations. Le code des articles est du code Haro. Là où un article a été écrit avant que la langue prenne son nom actuel, le nom a été changé et rien d'autre. Genre, domaine et série lus dans le nom du fichier, année tirée du premier commit : dérivés, jusqu'à ce que l'article porte son propre en-tête. Le fichier sur GitHub(s'ouvre dans un nouvel onglet)

