lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great KHMan once stated:
> 
> Coders should be able to break mental barriers. The table is part 
> of the bedrock of Lua. It's a lookup. NoSQL is a lookup. Google is 
> a lookup. Plenty of folks come around and say, it should be done 
> this way, it should be done that way. Perhaps they have notions of 
> how things should be done and wants to impose their mental 
> limitations on this new thing they are learning.

  I wouldn't call them "mental limitiations" and more like "expected
behavior."  Coming from C, starting arrays from 1 is odd.  Not so if you
come from Pascal.  For years, I felt hamstrung in C because there were
things I could trivially do in Assembly that were clumsy in C, but that was
be previous experience.  It took awhile to learn to speak C so to speak (and
even today, I still have a preference for vertically aligned code and plenty
of white space).

> Let's see. In the 1960s, Fortran and COBOL would be the two 
> greatest computer languages in the whole wide world, the amazing, 
> awesome 21st century future made live. Where does Fortran and 
> COBOL stand now? Where would we be 50 years from now?

  COBOL and Fortran are still around.  COBOL is probably legacy stuff, but
there still is new code written in Fortran (latest version is Fortran 2008;
there is a Fortran 2018 in the works).  

> 
> We must be able to break these mental barriers to move forward. 
> Must all computer languages have separate types for arrays and 
> hashes? Is it an inviolable design requirement that some coders 
> expect? Free your mind. :-)

  Must all computers languages have types?  They are useful, and in fact,
they could be more powerful in catching errors than they are now.  Let's see
...

	type lenth  as scalar
	type area   as scalar
	type volume as scalar

	op length + length = length
	op length * length = area
	op width  * length = volume -- also length * length * length

	type feet  as length
	type meter as length
	type acre  as area

	a : feet
	b : meter
	c : acre

	a = 5	-- five feet
	b = a	-- error, can't mix feet and meters
	b = tometer(a)	-- okay, assuming tometer is defined
			-- perhaps a way to auto convert is desired?

	c = a + a -- error, legth + length give length
	c = a * a -- okay

but I'm unaware of any language that has integrated units (it's a Unix
command) as part of the langauge.  I think it would be interesting to see
and might just have prevented the Mars Orbiter from blowing up because of
mixed units.

  -spc