Semantic-based linking

Sat, 2 Jan 1999 18:42:11 -0800 (PST)

On Sat, 26 Dec 1998, Anders Petersson wrote:

> I do, however, think the idea you presented is interesting. But I don't
> understand how you actually refer to a function without a name. Would a
> function name be constructed out of a description of the function, using
> strong syntax rules?

No.  When the author creates a program that uses the function, he directly
links to the function, because it is available in the persistent system.
When a user installs the new program on their system, it links to the same
function the author linked to.  If it can't find one, it waits until a
function is written or found, as soon as that happens the link happens and
afterwards you can use the new program.

> >This kind of "function lookup by meaning" (I call it semantic-based
> >linking, because semantics is meaning) is far better than what most
> >languages use today, linking by name.  Names are:  
> >
> >1. Language (i.e. English) specific 
> Necessarily.

I was trying to imply that language-specific is bad, therefore requiring
names is bad.  It would be better to have a system that did not require
names, because then the common language would be mathematics and logic,
instead of some arbitrary string.

> >2. Not precise specifiers of meaning, even to humans, that is, why use
> >"print" in C and "write" in Pascal?  "write" in C is a disk operation, and
> >"print" in DOS is a printer operation.  "write" in Win31 is a text editor.
> Good point. BTW, if using OOP, these functions could be abstracted to a
> generic "output" operation. I think this is the solution for UniOS, or
> rather mOS.

Yes, generic operations are how we solve it.

> >3. Meaningless to computers
> I can't see how you could refer to a function in a manner that's meaningful
> for computers, without using the actual address (function pointer).

An implementation may use a pointer.  But the direct persistent linking I
described above abstracts the implementation; no one ever has to see it.
It could be a pointer, or the functions might be compiled together in the
same memory space, who knows, and who cares.

Essentially I am proposing an abstraction of the source code, which still
contains the "what" is done while leaving out the "how".  "What" is
specification, or high level description of state change (yes, it is like
Laurent Martelli's suggestion of postcondition, very much).  "How" is the
low(er)-level implementation details, which can be anything as long as
they get the job done. 

> >4. Hard to remember when writing code
> Maybe, yes. At least the functions seldom used.
> >5. Hard to understand when reading code
> Not necessarily, if the chosen names are good.
> >What are the requirements to get semantic-based linking?  Basically, the
> >entire function's source must be abstracted and put in its interface!
> >"What!!!" you say.  I mean an abstract representation of behavior,
> >independent of implementation.  I call this 'specification.' It is the
> >meaning of a program (function) separate from a particular method of doing
> >it.  So for instance, the idea of a sort function, the fact that its input
> >is unsorted data and its output is sorted data.  Not whether it uses
> >bubble sort or shell sort or quick sort; those are implementation details.
> >But you need some way to describe what unsorted data is, and what sorted
> >data is (this is done by using LOGIC! Go learn it.  Too few Computer
> >Scientists do). That is the semantics of the function. SYNTAX is the bare
> >form of the function, the fact that it inputs a set of data and outputs
> >another set of data.  Too long has TYPE gone without inclusion of
> I think a practical example of how this would work would help me understand
> how it can be accomplished.

The semantics is the state change done by a function.  Usually all the
compiler knows about a function is its argument type and return type.  But
if the calling function can call by giving the specification of what it
needs to call... then an implementation can be searched for in a database
which given a specifiation returns the implementation.  Or, and this is
what I hope for, the implementation can be generated on the fly (but this
might not be done until later, and even then not for all functions).

I don't think that's an example.  Sorry.

David Manifold <>
This message is placed in the public domain.