[ale] On Programming and Programming Langauges

Michael B. Trausch mike at trausch.us
Fri Sep 17 11:37:32 EDT 2010


On Fri, 2010-09-17 at 11:28 -0400, Justin Simms wrote:
> Thanks for this post! There is nothing more fulfilling than reading an
> excellent summary of the strengths of learning C. I agree with you
> fully. I do, however, wish that more developers would be able to see
> that all programming languages add to understanding the whole of
> software engineering. Dynamic languages, strongly typed languages,
> etc..... Once we can step outside of the comfort zone of our "learned"
> language, we can then truly advance ourselves as engineers and forward
> thinkers. At least that is my take on things. 

I agree.  There are merits to every system.  One thing that I think is
that any program is best written in small, human-brain-sized building
blocks.  This is even more important when it comes to languages like
Python or PHP, where implicit type coercions can be easily found.  At
least for Python, it is nice that the expression:

  2 + 'x'

is invalid.  Contrast this to PHP, where it is not:

└─(11:33:%)── php   
<?php echo 2 + 'x'; ?>
2

In JavaScript, I think the result would be the string "2x", but I can't
remember for sure.  No matter, what, the bugs that can result from this
whole thing are sometimes very nasty and hard to track down, especially
if you have a whole large program that doesn't verify anything... you
get that sort of verification "for free" in languages where you don't
have implicit conversion.

One other thing that I really like, but rarely find, is the ability to
create restricted type domains.  For example, in Pascal, you can declare
a variable that holds an integer value but only the values 1, 2, 3.  Or
something along those lines.  You can then never assign a variable of
that type of a general-purpose integer; that is a type error.  Oh, boy,
is that nice.  Even two differently named types that have the same range
aren't considered to be compatible for the purposes of the type system,
you have to manually force a conversion between them.  That is something
that I wish more modern languages would do, so that if you have two
variables (of type empl_type_t and mgr_type_t, for example that have the
same range of values) you can't comingle them.  While it would not be a
programming error to do so, it would be a semantic error, and it's nice
to have a programming langauge which could catch such a semantic error.

	--- Mike



More information about the Ale mailing list