C* domains and the birth of infolinguistics
Your programming languages are not fully languages… yet.
One of the more recent additions to the C* programming language is a namespace-like construct called domains. Uniquely among namespacing constructs though, domains are limited to four levels of hierarchy including the base symbol name itself – this is both for the sake of brevity and simplicity and for a more fundamental concept at work behind them in the authorship buttressed by mechanicalist thinking. Today I’d like to get into why this is and what value it can bring to us as programmers.
From the authoritative wiki page:
What other languages often call ‘modules’ or ‘namespaces’ are provided by C* as domains. Domains are a simple semantic grouping tool for making coherent collections of symbols and identifiers. In contrast to C++ namespaces, they are not lexically ‘grouping’, that is, they are merely declared to exist, and used in other declarations directly as desired.
While in a vacuum, C*’s domains hardly justify their existence in light of the sufficiency of normal symbols as in ANSI C, the utility can be realised in how it makes possible smarter contextualisation of parameters for routine calls and structure initialisation, like so:
domain mylib; enum mylib.foo { PRIMA, SECUNDA }; void mylib.bar( enum mylib.foo e ); /* regardless of the presence of using statements, the enum would be * contextualised in the routine call so it never needs qualifying */ mylib.bar( PRIMA ); /* or, with using */ using mylib.bar; bar( SECUNDA ); /* never brought in enum mylib.foo directly */ /* this can be avoided by globalising the call with a leading dot */ .mylib.bar( mylib.PRIMA ); /* or, with using */ using mylib.bar; .bar( mylib.SECUNDA );The main danger of domains is obfuscation of interface – for this reason, C* disallows
usingstatements outside of block scope, and additionally forbids any form of ‘wildcard’ selectors inusingstatements entirely. Since the above feature of soft contextualisation applies to all identifiers in a given domain, the application ofusingstatements as a general ‘decluttering’ is avoided and refitted solely as a tool for bringing desired subroutines into scope. In this spirit, C* mandates thatusingstatements are hoisted to the top of the block scope, before all variable declarations.
For the proficient programmer, that is introduction enough. But later on, the feature comes up again in the context of symbol limits:
As the preeminent mechanicalist systems programming language, C* also imposes limits on symbols and other identifiers. Specifically:
up to 4 levels of
domainhierarchy including the final symbol
This limit helps programmers make code modular while still remaining manageable in its own right, but it hearkens toward a cross-discipline I’m not sure exists yet in quite the way I envision it: infolinguistics.
The most basic way to grok the idea of infolinguistics is to load up the Linux man pages (perhaps even online) and declare the thing to be a collection of dictionaries. Yes, in the elementary sense of the word, rather than the informatical meaning.
The Linux man pages in particular offer us a particularly colourful set of dictionaries in the sense that the various sections correspond to different kinds of words: section 3, for example, has the useful ceil() math function, while section 1 has the diff utility commonly used in patch authoring.
In the same vein as these man pages, then, does a domain acquire its ultimate purpose: the collation of words into a book, the book being, of course, a dictionary. Given the particulars of C*, though, a rough sketch of how the full hierarchy might look is as follows:
language.canon.book.word
For example:
win32.printf, or posix.linux.printf, or (abstractly) posix.printf
...where generally printf sends formatted output to stdout as described in standard C
The highest level, 'language', serves as a separation of last resort, in cases where many words may be similar but their meaning is so distant that it is like a different natural language. Thankfully, we don't yet have this degree of divergence in programming language much yet! Certain Haskell-isms may qualify though...
Also, this hierarchy isn't strict, as in, it is by its constitution naturally self-collapsing: if you had a 'canon' with only one book, it is really just a book. Don't overthink it!This expression provides a more complete articulation of the organic and multiplicitous reality of computer code, where a commonly used symbol name like malloc—or the family of subroutine names related to it—can be defined both in the general case and also expounded upon encyclopaedically for each of the many notable implementations. Where the definition of such a name differs, a difference in dialect is discovered, in much the same way as seen in natural language.
What I am describing here is a toolkit for exposing the true language being articulated by programmers in the course of authoring code – not ‘language’ in the narrow, established sense of lexical symbols and context-free parsers, but language in the human sense of revolving around the vocabulary bearing the meaning of our programs. The study of this is infolinguistics, and in time as the broader idea of mechanicalism flourishes it will come to supplant the archaic caricature of proper linguistics currently delineating programming language theory as we know it today.
In the near future, I expect to undertake work documenting a dictionary for PC DOS and its clones, including MS-DOS, DR-DOS and Novell DOS among others. After this, perhaps I could continue it into work on early Unix and eventually Linux as well as Darwin, along with extending the DOS family dictionary into Microsoft Windows. But more important to me is the DOS family dictionary, as it will prove more immediately useful in the course of developing Sirius DOS in support of Anodyne.
I hope you enjoyed this article on informatics (also known as computer science). If you aren’t already aware, I am running for Congress, and while it’s far from an easy task, some very intelligent people in my corner of this fight are reporting I’m holding a 15 while the dealer is showing a 2. I am happily fundraising, and I have video editing going on full-time that will break me out so all of you can enjoy my full personality and help carry that energy I need to win. Regardless of how it goes, writings like these from me will continue to arrive the same, because I love computers.



