h1

Hiding References…the next “Procedural Breakthrough”

July 11, 2014

The introduction of procedural programming was the largest step forward in the history of programming design.much more so that what Object Orientation The basic idea is you get rid of gotos. You do that by finding the non pathological cases and turning them into specialised structures.

References,(and particularly pointers, raw, machine level references)are the gotos of data. They can lead to a host problems, including circularity, and “dangling” (premature dereference ).

The process of getting rid of explicit references is similar to the process forgetting rid of gotos: identify the use cases, and replace them with special purpose constructs. (Of course, raw pointers will gave to be used somewhere down in the machinery, for the same reason that implied gotos will implement for, if and while in procedural languages)

Pointers are used to implement complex databstruxtures such as trees an linked lists in languages lke C, so one tranche of references can be got rid of by using flexible data containers.
The other main use is passing data out of subroutines. The safe pattern is to pass in a references from outer scope, for the subroutine to modify. This avoids the problems attendant on a subroutine passing out references to their local variables, which might have beendestroyed, leaving the pointer dangling.

Both those techniques are used in the new language Parasail.

One might wonder why it took so long to get rid of the “second goto”.

The rise of object orientation ameliorates the use of references to pass data out of a subroutine. “This” and “self” are effectively implicit references, when used in modifiers. And the rise of dynamic languages ameliorate the use if references to build dynamic structures,…dynamic languages often have references, but their programmers rarely need them.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: