lua-users home
lua-l archive

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


Hello,

I have read two additional chapters of Roberto's book (the draft). I haven't
much time to read it from cover to cover (if I can say for a printed .ps
file...) but it is truly excellent...

First, two remarks, before I forget them:
Page 72 (11.2 Matrices and multi-dimensional arrays), there is a code
snippet that seems incorrect:
there are two similar lines:
  for j=1,M do
and
  while j <= M do
and only one 'end' for both... I guess it is a leftover of the old 3.2
syntax...

Page 74 (11.4 Queues and Double Queues), you state that indices of a double
queue can grow almost infinitely because they are actually doubles, so they
can be quite large.
But since the doubles are handled by the compiler / run-time library, I
suppose they are stored in a limited space (as opposed to large number
libraries). 48 bits, if I recall correctly (and if this is standard, I am not a
specialist here).
So after some time, values will be rounded and manipulated with exponents of
ten, so small increments will be lost.

I made a little test:

val1 = 314159265358979323
val2 = val1 + 1
print(val1, val2, val2 - val1)

result on Windows NT:
3.141592653589793e+017	3.141592653589793e+017	0

OK, I made a small test, the limit seems to be between 9,007,190,000,000,000
and 9,007,200,000,000,000, so you may be quite right finally...
It may be interesting to state this limit (if it is standard induced)
somewhere, I think.

-----

No recent news of the book. I suppose Roberto is focussing on the release of
Lua 4.1... Even more if the book must be updated to this version...
Do you plan to release the whole, finished book in electronic form, in
addition to the printed form?
Somebody (http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html) has done
it before, without reverse effect on the sales, it seems.

-----

I am writing Windows software. The usual options to save user options are:
- use the registry
- use the old .ini file format
- use proprietary format.

I don't like using the registry for such task. It makes it growth, it is
hard to access, it makes hard to backup these data, and if you just remove the
program directory to uninstall it, data remains in the registry.

The .ini format is fine, except it doesn't support multi-users (or you must
handle these by hand), and it is not hierarchical.

I was going to make my own, hierarchical, textual proprietary format, when I
discovered Lua.
I haven't embedded Lua in an application yet, but I find the idea of using
it for storing data is very interesting. Lua is small enough to avoid to bloat
even the smallest programs, and it provides other facilities, like scripting
(!), that are good too.
I mean, some applications may have no use of scripting, but it can be
interesting to embed Lua anyway for its persistance properties alone.

-----

Another though while reading the Data Structures chapter:
I am struggling to make a generic, non-template based, double-linked list
class in C++. Struggling because I am not master of object design... Any
pointer on this would be appreciated, BTW.
So I though: "Can I use Lua to handle such structure?".
I mean, I know I can, but is this practical?
Sorry, I haven't read thouroughly the API section of the manual yet.
I don't intend to use very big datasets, so performance and memory are not
an issue (though it could be interesting to see how this scale).

Do you think it is a viable option (to delegate the use of such data
structures, like lists, dictionaries, etc.)? The purpose is to avoid to reinvent the
wheel and to use a fast and reliable implementation. But access to the data
must be simple and readable, even if I must write some wrapper functions.

Want do you think?

Regards.

-- 
--._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`--

Sent through GMX FreeMail - http://www.gmx.net