lua-users home
lua-l archive

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


On Tue, Mar 25, 2014 at 3:30 PM, Jerome Vuarand
<jerome.vuarand@gmail.com> wrote:
> 2014-03-25 19:39 GMT+00:00 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>>> The important thing is that algorithms implemented in other languages
>>> should be straightforwardly portable. Having an algorithm that needs
>>> changed for Lua and Lua alone is the violation of the principle of
>>> least surprise.
>>
>> This would also be a good argument.
>
> Is it really? If any algorithm is straightfowardly portable from
> language A to language B (and, by extension, vice versa), what is the
> point of having these two languages rather than keeping just one?

Algorithms are, theoretically, language-independent. A process is a
process, and the only thing that differs from language to language is
the syntax used to express it. If you need to add two, and then shift
three bits to the right, that's the same algorithm whether you write
"(x+2) >> 3", "(ash -3 (+ x 2))", or "add 2, %rax; sar 3, %rax".

Saying that there's no reason to be able to migrate algorithms between
languages is tantamount to falling into the Turing Tarpit -- languages
have advantages relative to each other beyond just being able to
express an algorithm, so being able to adapt things between them is
important.

/s/ Adam