ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: why lua?
Date: Sat, 18 Dec 2010 12:03:22 +0100	[thread overview]
Message-ID: <20101218110322.GB17742@aides> (raw)
In-Reply-To: <AANLkTinNw0J0eNco5XME0hBofXyXMJ+8WKARy3Wbnuyc@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2267 bytes --]

On 2010-12-18 <01:50:29>, Philipp A. wrote:

<snip lines="some"/>

> well, i just like it. and since i don’t know lua (well, that’s not exactly
> true, but i can’t write a normal sized script without looking things up),
> and tend to do things like i would do them in other languages i know. e.g.:
> how do you loop elegantly over table values? “for k,v in pairs(t) do print(v)
> end” creates a throwaway variable k, which doesn’t seem right. some things

Depending on whether you want to access the non-hashed content as
well you might want to use the “next” iterator instead as it’s
slightly faster (according to my tests, that is). You won’t get
around the local variable, though; I have no clue and no time to
check if it’s even technically feasible to iterate a hash table
without accessing the hashes.

> are totally counter-intuitive for me like tables beginning with index 1, and
> so on.

Feels natural after some time, I guarantee. And you’ll never look
the same way at a fencepost again …

What you’ll miss most is all the nice shortcuts and syntactic
sugar like “setdefault(k,[]).append(v)” (two lines in Lua) and
the lazy handling of arrays, strings &c. as sequences that can be
iterated over like it was all the same, and probably the error
handling. Nothing you can’t live without.

> > Anyhow, I don't like languages that need religious arguments to become
> > popular.

> or are you talking about lua having been invented at a catholic university
> and thus being a product of a sect somehow?

Never looked at it that way. There should be a “fun facts”
section on the wiki to list all the confusing mysteries
surrounding context.

Regards,
Philipp


PS:

> kross is the project for bringing consistent scripting to KDE, and it is
> just awesome, since it allows you to write stuff in the scripting language
> of your choice.

Apart from being OT, you can always switch to a window manager
that uses your favorite scripting language instead -- mine has
Lua inside which is a lot cleaner than doing configuration in
e.g. bash or something.



-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2010-12-18 11:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-17 15:20 Jonas Stein
2010-12-17 21:46 ` Martin Schröder
2010-12-17 22:35 ` Philipp A.
2010-12-17 22:51   ` Hans Hagen
2010-12-18  8:35     ` luigi scarso
2010-12-17 22:48 ` Hans Hagen
2010-12-17 23:27 ` Philipp Gesang
2010-12-17 23:46   ` Hans Hagen
2010-12-18  0:50     ` Philipp A.
2010-12-18  5:56       ` Aditya Mahajan
2010-12-18 11:03       ` Philipp Gesang [this message]
2010-12-18 11:35         ` Hans Hagen
2010-12-18 13:06           ` Philipp Gesang
2010-12-18 13:20             ` Hans Hagen
2010-12-18 14:17               ` Philipp Gesang
2010-12-18 18:54                 ` Hans Hagen
2010-12-18 11:31       ` Taco Hoekwater
2010-12-18 13:04       ` Hans Hagen
2010-12-18 13:18         ` luigi scarso
2010-12-18 13:24           ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101218110322.GB17742@aides \
    --to=pgesang@ix.urz.uni-heidelberg.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).