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 Dirk Laurie once stated:
> Op Ma., 17 Sep. 2018 om 09:36 het Sean Conner <sean@conman.org> geskryf:
> >
> > It was thus said that the Great Dirk Laurie once state
> 
> I was hoping that my footnotes, giving the corresponding Lua
> functions, would make that clear.
> 
> > > [1] In Lua, by way of type and number of return values, especially
> > > "false, message"'
> > > [2] In Lua, by way of error())
> > > [3] In Lua, by way of os.exit()
> > > [4] In Lua, by way of pcall()
> 
> But let's try again.
> 
> Level 0    Operating system (whether shell or GUI)
> Level 1    Invokes a command or starts an application called "lua",
> "python", "perl", "ruby", "js", "apl", "love", "luatex" etc.
> Level 2    which invokes code written in a 'scripting" language
> Level 3    which calls a function
> Level 4    which calls a function
> ...
> Level n    which encounters a condition that makes it impossible to go
> on as normal.

  Okay.

> Now from level n, Lua code can say: return to level  0 (bypassing all
> finalizers not regestered at that level) or return to level 1
> (allowing various sorts of recovery) or drop down to level n-1
> (passing the buck). In addidition, Level n-1 may disallow a direct
> return to Level 1.

  Much more clear (at least to me).  

> The questions to agree or disagree on are:
> 
> (a) All languages that involve at least Levels 0,1,2 should offer all
> those options.

  I would have to agree, if only because of my hate of Go (whose developers
patronize programmers as being too dumb to understand programming [10]).  I
may not like the mechanism but that's me, and I'm not going to force my
preferences onto other people (force my opionions?  Sure, but not my
preferences [11]).

> (b) Very few except Lua actually offer that.

  Citation needed.  Even C can do that:

	Level 0: exit()
	Level 0: _exit() -- Do not pass C finalizers.  Do not collect $200 [12]

	Level 1: via signal(), sigsetjmp() and siglongjmp()
	Level n: via setjmp(), longjmp() (or signal, sigsetjmp(),
	         siglongjmp() if you really want to be masochistic).

  I would be surprised if Python, Ruby and Perl couldn't do that as well. 
LISP has more options than Lua.  And the tricks you can do in Forth are only
exceeded by the tricks you can do in assmebly.

  So here, I would disagree.

  -spc (I think Pascal doesn't allow that, but that was designed for
	teaching, not actual work ... )

[5] ... [9] : not included

[10]	It would be hypocritical of me to say "don't use that" when I refuse
	to use Go because of their own "don't use that" stance with their
	own langauge.

[11]	A friend of mine does tech support.  When I've gone to him for
	issues (not very often) he will immedately change settings like
	screen resolution and font size because "Well, that's what I like,
	and what I like is obviously what everybody should like." I had to
	hit him a few times with a clue-by-four to stop that rude behavior.

[12]	Monopoly game reference.