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 Paige DePol once stated:
> 
> I can see parallels here with programming languages, when you come from a
> language with a robust syntax, think Perl, to one not as verbose, such as
> Lua, it can be difficult to adjust... I know it took me a while to stop
> trying to append my if statements on single expressions! However, once you
> get used to the limited syntax and use it for a long time it may be harder
> to think in terms of the constructs you haven't used for a long time.

  The problem I have with Perl is that there are so many variations on
syntax [1] ("More than one way to do it!") that it becomes difficult to read
other people's code.  And I know that I find it odd to think of an
expression negated by a conditional *afterwards!* The whole

	do_this() if that;

just seems ... odd to me.  [2]  But I can see where you are coming from. 
There were plenty of things I couldn't express in C that I could in
assembly.  Things like anonymous variables:

		push	100	; we're doing something 100 times

	again:
		; lots of code using all registers

		dec	[esp]	; are we there yet?
		jne	again

No need to name the variable.  Then there was the ability to return multiple
values (still something I sorely miss in C).  And it cuts both ways---after
programming in C for the past twenty years, there are things I now miss when
programming in Assembly [3], like not having to think about register
allocation, or mismanaging the stack [4].

> One thing I always enjoy is discovering the uncommon syntax used by other
> programming languages. It is always interesting to learn new ways I could
> potentially think in terms of coding!

  One of the books that changed how I code [5] is _Thinking Forth_ by Leo
Brodie.  Yes, it's geared for Forth, but it really got me thinking about
code in general and how I approach it.

> This desire to express my code with different structures is also what helps
> drive my patching of Lua. That and a desire to hack and learn what makes
> things work the way they do! :)

  For a real mindblowing language, look up INRAC.  It's a non-deterministic
language with the oddest flow control mechanism I've ever seen.  And I know
of three commercial products written with INRAC [6].

  -spc

[1]	Understandable when one realizes that Perl was designed and written
	by a linguist, who likes to use implicit pronouns.

[2]	Then again, I never liked Perl to start with.

[3]	For fun these days.  

[4]	Mismatched push/pop instructions, not stack overwriting.

[5]	The other one is _Writing Solid Code_.  Yes, it's published by
	Microsoft and I get the irony.  It's still a great book.

[6]	Only two of which are programs!